From: Veaceslav Falico Date: Fri, 29 Nov 2013 08:53:23 +0000 (+0100) Subject: af_packet: block BH in prb_shutdown_retire_blk_timer() X-Git-Tag: v3.4.73~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4da7a3c088de8b4cb1c4523a3e22eb1aafb95e3;p=platform%2Fkernel%2Flinux-stable.git af_packet: block BH in prb_shutdown_retire_blk_timer() [ Upstream commit ec6f809ff6f19fafba3212f6aff0dda71dfac8e8 ] 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: f6fb8f100b80 ("af-packet: TPACKET_V3 flexible buffer implementation.") CC: "David S. Miller" CC: Daniel Borkmann CC: Willem de Bruijn CC: Phil Sutter CC: Eric Dumazet Reported-by: Jan Stancek Tested-by: Jan Stancek Signed-off-by: Veaceslav Falico Acked-by: Daniel Borkmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 853811a..dbe1715 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -504,9 +504,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); }