mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
net: ipv4: fix infinite loop on secondary addr promotion
secondary address promotion causes infinite loop -- it arranges
for ifa->ifa_next to point back to itself.
Problem is that 'prev_prom' and 'last_prim' might point at the same entry,
so 'last_sec' pointer must be obtained after prev_prom->next update.
Fixes: 2638eb8b50
("net: ipv4: provide __rcu annotation for ifa_list")
Reported-by: Ran Rozenstein <ranro@mellanox.com>
Reported-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5b9469a285
commit
6a9e9cea4c
@ -428,8 +428,9 @@ no_promotions:
|
||||
if (prev_prom) {
|
||||
struct in_ifaddr *last_sec;
|
||||
|
||||
last_sec = rtnl_dereference(last_prim->ifa_next);
|
||||
rcu_assign_pointer(prev_prom->ifa_next, next_sec);
|
||||
|
||||
last_sec = rtnl_dereference(last_prim->ifa_next);
|
||||
rcu_assign_pointer(promote->ifa_next, last_sec);
|
||||
rcu_assign_pointer(last_prim->ifa_next, promote);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user