diff options
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index cbadb942c332..793c0bb8c4fd 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -596,12 +596,12 @@ static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash) | |||
596 | 596 | ||
597 | static inline u32 fnhe_hashfun(__be32 daddr) | 597 | static inline u32 fnhe_hashfun(__be32 daddr) |
598 | { | 598 | { |
599 | static u32 fnhe_hashrnd __read_mostly; | ||
599 | u32 hval; | 600 | u32 hval; |
600 | 601 | ||
601 | hval = (__force u32) daddr; | 602 | net_get_random_once(&fnhe_hashrnd, sizeof(fnhe_hashrnd)); |
602 | hval ^= (hval >> 11) ^ (hval >> 22); | 603 | hval = jhash_1word((__force u32) daddr, fnhe_hashrnd); |
603 | 604 | return hash_32(hval, FNHE_HASH_SHIFT); | |
604 | return hval & (FNHE_HASH_SIZE - 1); | ||
605 | } | 605 | } |
606 | 606 | ||
607 | static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) | 607 | static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) |
@@ -628,12 +628,12 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, | |||
628 | 628 | ||
629 | spin_lock_bh(&fnhe_lock); | 629 | spin_lock_bh(&fnhe_lock); |
630 | 630 | ||
631 | hash = nh->nh_exceptions; | 631 | hash = rcu_dereference(nh->nh_exceptions); |
632 | if (!hash) { | 632 | if (!hash) { |
633 | hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC); | 633 | hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC); |
634 | if (!hash) | 634 | if (!hash) |
635 | goto out_unlock; | 635 | goto out_unlock; |
636 | nh->nh_exceptions = hash; | 636 | rcu_assign_pointer(nh->nh_exceptions, hash); |
637 | } | 637 | } |
638 | 638 | ||
639 | hash += hval; | 639 | hash += hval; |
@@ -1242,7 +1242,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) | |||
1242 | 1242 | ||
1243 | static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr) | 1243 | static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr) |
1244 | { | 1244 | { |
1245 | struct fnhe_hash_bucket *hash = nh->nh_exceptions; | 1245 | struct fnhe_hash_bucket *hash = rcu_dereference(nh->nh_exceptions); |
1246 | struct fib_nh_exception *fnhe; | 1246 | struct fib_nh_exception *fnhe; |
1247 | u32 hval; | 1247 | u32 hval; |
1248 | 1248 | ||