Skip to content

Commit

Permalink
af_packet: block BH in prb_shutdown_retire_blk_timer()
Browse files Browse the repository at this point in the history
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.

Fixes: f6fb8f1 ("af-packet: TPACKET_V3 flexible buffer implementation.")
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]>
Acked-by: Daniel Borkmann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Veaceslav Falico authored and davem330 committed Nov 29, 2013
1 parent 006da7b commit ec6f809
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit ec6f809

Please sign in to comment.