[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1385715203-14712-1-git-send-email-vfalico@redhat.com>
Date: Fri, 29 Nov 2013 09:53:23 +0100
From: Veaceslav Falico <vfalico@...hat.com>
To: netdev@...r.kernel.org
Cc: jstancek@...hat.com, Veaceslav Falico <vfalico@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <dborkman@...hat.com>,
Willem de Bruijn <willemb@...gle.com>,
Phil Sutter <phil@....cc>, Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH v2 net] 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.
CC: "David S. Miller" <davem@...emloft.net>
CC: Daniel Borkmann <dborkman@...hat.com>
CC: Willem de Bruijn <willemb@...gle.com>
CC: Phil Sutter <phil@....cc>
CC: Eric Dumazet <edumazet@...gle.com>
Reported-by: Jan Stancek <jstancek@...hat.com>
Tested-by: Jan Stancek <jstancek@...hat.com>
Signed-off-by: Veaceslav Falico <vfalico@...hat.com>
---
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(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ac27c86..ba2548b 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -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);
}
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists