summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorGao Feng <fgao@ikuai8.com>2016-08-31 14:15:05 +0800
committerDavid S. Miller <davem@davemloft.net>2016-09-01 22:45:03 -0700
commit635c223cfa05af9523146b2f37e119d945f449ae (patch)
tree836a3ec0989ac301c54c800a08331d7b2a48b1da /net/core
parent28b346cbc0715ae45b2814d857f1d8a7e6817ed8 (diff)
downloadtalos-obmc-linux-635c223cfa05af9523146b2f37e119d945f449ae.tar.gz
talos-obmc-linux-635c223cfa05af9523146b2f37e119d945f449ae.zip
rps: flow_dissector: Fix uninitialized flow_keys used in __skb_get_hash possibly
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. Fixes: 6db61d79c1e1 ("flow_dissector: Ignore flow dissector return value from ___skb_get_hash") Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/flow_dissector.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 61ad43f61c5e..52742a02814f 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);
OpenPOWER on IntegriCloud