Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2019-07-09 08:58:53 +0200
committerMichal Kubecek <mkubecek@suse.cz>2019-07-09 08:59:08 +0200
commit545b7bdc13948b37e21f6158508e40ba886745e9 (patch)
tree78829dfa55caab2708e874a476b205a682394c88
parentb7aa760403ec70e0c95fe900db99702e9c0de54b (diff)
netns: get more entropy from net_hash_mix() (CVE-2019-10638
bsc#1140575). suse-commit: b97d2b165fb695c91e2d47857f0fd3feebd901f4
-rw-r--r--include/net/netns/hash.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h
index 69a6715d9f3f..2d87627aaf57 100644
--- a/include/net/netns/hash.h
+++ b/include/net/netns/hash.h
@@ -8,12 +8,7 @@ struct net;
static inline u32 net_hash_mix(const struct net *net)
{
#ifdef CONFIG_NET_NS
- /*
- * shift this right to eliminate bits, that are
- * always zeroed
- */
-
- return (u32)(((unsigned long)net) >> L1_CACHE_SHIFT);
+ return (u32)(((unsigned long)net) >> ilog2(sizeof(*net)));
#else
return 0;
#endif