diff options
author | Chinmay Agarwal <chinagar@codeaurora.org> | 2021-04-22 01:12:22 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-03 09:00:52 +0200 |
commit | 5c7b23b7962865766147c5d7dc3f6e15b96dbe18 (patch) | |
tree | 2d7adc70c6831252cb044e14aed770d333270a50 /drivers/usb/core/hub.h | |
parent | 9427906999778401518c592662c8801d00eb46bb (diff) | |
download | kernel_replicant_linux-5c7b23b7962865766147c5d7dc3f6e15b96dbe18.tar.gz kernel_replicant_linux-5c7b23b7962865766147c5d7dc3f6e15b96dbe18.tar.bz2 kernel_replicant_linux-5c7b23b7962865766147c5d7dc3f6e15b96dbe18.zip |
neighbour: Prevent Race condition in neighbour subsytem
commit eefb45eef5c4c425e87667af8f5e904fbdd47abf upstream.
Following Race Condition was detected:
<CPU A, t0>: Executing: __netif_receive_skb() ->__netif_receive_skb_core()
-> arp_rcv() -> arp_process().arp_process() calls __neigh_lookup() which
takes a reference on neighbour entry 'n'.
Moves further along, arp_process() and calls neigh_update()->
__neigh_update(). Neighbour entry is unlocked just before a call to
neigh_update_gc_list.
This unlocking paves way for another thread that may take a reference on
the same and mark it dead and remove it from gc_list.
<CPU B, t1> - neigh_flush_dev() is under execution and calls
neigh_mark_dead(n) marking the neighbour entry 'n' as dead. Also n will be
removed from gc_list.
Moves further along neigh_flush_dev() and calls
neigh_cleanup_and_release(n), but since reference count increased in t1,
'n' couldn't be destroyed.
<CPU A, t3>- Code hits neigh_update_gc_list, with neighbour entry
set as dead.
<CPU A, t4> - arp_process() finally calls neigh_release(n), destroying
the neighbour entry and we have a destroyed ntry still part of gc_list.
Fixes: eb4e8fac00d1("neighbour: Prevent a dead entry from updating gc_list")
Signed-off-by: Chinmay Agarwal <chinagar@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/hub.h')
0 files changed, 0 insertions, 0 deletions