af_packet: block BH in prb_shutdown_retire_blk_timer()
Subsystems (3)
PATCH v2 1/1 af_packet: block BH in prb_shutdown_retire_blk_timer()
Currently we're using plain spin_lock() in prb_shutdown_retire_blk_timer(), however the timer might fire right in the middle and thus try to re-aquire the same spinlock, leaving us in a endless loop.
To fix that, use the spin_lock_bh() to block it.
---
Notes:
v1 -> v2:
Per Eric's suggestion, reward the commit message to actually match the patch (thanks a lot!).
net/packet/af_packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/packet/af_packet.c +2 -2
@@ -439,9 +439,9 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po, pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc; -spin_lock (&rb_queue->lock); +spin_lock_bh (&rb_queue->lock); pkc->delete_blk_timer =1 ; -spin_unlock (&rb_queue->lock); +spin_unlock_bh (&rb_queue->lock);prb_del_retire_blk_timer (pkc); }
Signature · 1 line
1.8.4
Quoted 6 lines · Veaceslav Falico
Currently we're using plain
spin_lock()inprb_shutdown_retire_blk_timer(), however the timer might fire right in the middle and thus try to re-aquire the same spinlock, leaving us in a endless loop.To fix that, use the
spin_lock_bh()to block it.
Quoted 8 lines
CC "David S. Miller" <[email protected]>CC Daniel Borkmann <[email protected]>CC Willem de Bruijn <[email protected]>CC Phil Sutter <[email protected]>CC Eric Dumazet <[email protected]>Reported-by Jan Stancek <[email protected]>Tested-by Jan Stancek <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>
Thanks everyone!
David Miller
maintainerFrom: Daniel Borkmann <[email protected]>
Date: Fri, 29 Nov 2013 10:19:29 +0100
Quoted 18 lines · Veaceslav Falico
Quoted 8 lines
Currently we're using plain
spin_lock()inprb_shutdown_retire_blk_timer(),
however the timer might fire right in the middle and thus try to re-aquire
the same spinlock, leaving us in a endless loop.To fix that, use the
spin_lock_bh()to block it.Quoted 8 lines
CC "David S. Miller" <[email protected]>CC Daniel Borkmann <[email protected]>CC Willem de Bruijn <[email protected]>CC Phil Sutter <[email protected]>CC Eric Dumazet <[email protected]>Reported-by Jan Stancek <[email protected]>Tested-by Jan Stancek <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>
Quoted 3 lines
Fixes f6fb8f100b80 ("af-packet: TPACKET_V3 flexible bufferimplementation.")
Acked-by Daniel Borkmann <[email protected]>
Applied and queued up for -stable, thanks!