* [PATCH net] rps: flow_dissector: Fix uninitialized flow_keys used in __skb_get_hash possibly
@ 2016-08-31 2:56 fgao
2016-08-31 4:14 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: fgao @ 2016-08-31 2:56 UTC (permalink / raw)
To: davem, philipp, tom, aduyck, amir, netdev, linux-kernel; +Cc: gfree.wind, fgao
From: Gao Feng <fgao@ikuai8.com>
The original codes depend on that the function parameters are evaluated from
left to right. But the parameter's evaluation order is not defined in C
standard actually.
When flow_keys_have_l4(&keys) is invoked before ___skb_get_hash(skb, &keys,
hashrnd) with some compilers or environment, the keys passed to
flow_keys_have_l4 is not initialized.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
net/core/flow_dissector.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 61ad43f..52742a0 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -680,11 +680,13 @@ EXPORT_SYMBOL_GPL(__skb_get_hash_symmetric);
void __skb_get_hash(struct sk_buff *skb)
{
struct flow_keys keys;
+ u32 hash;
__flow_hash_secret_init();
- __skb_set_sw_hash(skb, ___skb_get_hash(skb, &keys, hashrnd),
- flow_keys_have_l4(&keys));
+ hash = ___skb_get_hash(skb, &keys, hashrnd);
+
+ __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys));
}
EXPORT_SYMBOL(__skb_get_hash);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] rps: flow_dissector: Fix uninitialized flow_keys used in __skb_get_hash possibly
2016-08-31 2:56 [PATCH net] rps: flow_dissector: Fix uninitialized flow_keys used in __skb_get_hash possibly fgao
@ 2016-08-31 4:14 ` Eric Dumazet
2016-08-31 4:16 ` Gao Feng
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2016-08-31 4:14 UTC (permalink / raw)
To: fgao; +Cc: davem, philipp, tom, aduyck, amir, netdev, linux-kernel, gfree.wind
On Wed, 2016-08-31 at 10:56 +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> The original codes depend on that the function parameters are evaluated from
> left to right. But the parameter's evaluation order is not defined in C
> standard actually.
>
> When flow_keys_have_l4(&keys) is invoked before ___skb_get_hash(skb, &keys,
> hashrnd) with some compilers or environment, the keys passed to
> flow_keys_have_l4 is not initialized.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
Good catch, please add
Fixes: 6db61d79c1e1 ("flow_dissector: Ignore flow dissector return value from ___skb_get_hash")
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] rps: flow_dissector: Fix uninitialized flow_keys used in __skb_get_hash possibly
2016-08-31 4:14 ` Eric Dumazet
@ 2016-08-31 4:16 ` Gao Feng
0 siblings, 0 replies; 3+ messages in thread
From: Gao Feng @ 2016-08-31 4:16 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S. Miller, Philp Prindeville, Tom Herbert, Alex Duyck,
amir, Linux Kernel Network Developers, linux-kernel
On Wed, Aug 31, 2016 at 12:14 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2016-08-31 at 10:56 +0800, fgao@ikuai8.com wrote:
>> From: Gao Feng <fgao@ikuai8.com>
>>
>> The original codes depend on that the function parameters are evaluated from
>> left to right. But the parameter's evaluation order is not defined in C
>> standard actually.
>>
>> When flow_keys_have_l4(&keys) is invoked before ___skb_get_hash(skb, &keys,
>> hashrnd) with some compilers or environment, the keys passed to
>> flow_keys_have_l4 is not initialized.
>>
>> Signed-off-by: Gao Feng <fgao@ikuai8.com>
>> ---
>
> Good catch, please add
>
> Fixes: 6db61d79c1e1 ("flow_dissector: Ignore flow dissector return value from ___skb_get_hash")
> Acked-by: Eric Dumazet <edumazet@google.com>
>
>
Add it into the description and resend the patch again?
Best Regards
Feng
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-31 4:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31 2:56 [PATCH net] rps: flow_dissector: Fix uninitialized flow_keys used in __skb_get_hash possibly fgao
2016-08-31 4:14 ` Eric Dumazet
2016-08-31 4:16 ` Gao Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).