]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
neighbour: fix a race in neigh_destroy()
authorEric Dumazet <eric.dumazet@gmail.com>
Fri, 28 Jun 2013 09:37:42 +0000 (02:37 -0700)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 May 2014 05:53:44 +0000 (07:53 +0200)
commitaf6739a5fe47e23aef27d8057db0edbccb13da52
tree66ae05c888285c7d3bb894c14df32564ab6430e7
parent6597b256646d4ff022bedd364b59fa3de0c05acc
neighbour: fix a race in neigh_destroy()

[ Upstream commit c9ab4d85de222f3390c67aedc9c18a50e767531e ]

There is a race in neighbour code, because neigh_destroy() uses
skb_queue_purge(&neigh->arp_queue) without holding neighbour lock,
while other parts of the code assume neighbour rwlock is what
protects arp_queue

Convert all skb_queue_purge() calls to the __skb_queue_purge() variant

Use __skb_queue_head_init() instead of skb_queue_head_init()
to make clear we do not use arp_queue.lock

And hold neigh->lock in neigh_destroy() to close the race.

Reported-by: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/core/neighbour.c