Subject: Re: [PATCH] Deadlock in af_packet/packet_rcv

From: Olaf Kirch <[email-masked]>
Date: Tue, 30 Nov 2004 11:48:04 +0100

On Mon, Nov 29, 2004 at 08:02:20PM -0800, David S. Miller wrote:
> If it's only the dev_queue_xmit_nit() handlers which all want
> BHs disabled, why don't we just disable BHs in that function?

That was my original fix (see attachment), but Andi Kleen suggested to
actually disable BHs at that level; I think as a matter of caution.

Olaf
-- 
Olaf Kirch     | Things that make Monday morning interesting, #2:
[email-masked]   |        "We have 8,000 NFS mount points, why do we keep
---------------+ 	 running out of privileged ports?"
Index: linux-2.6.9/net/core/dev.c
===================================================================
--- linux-2.6.9.orig/net/core/dev.c	2004-10-18 23:54:08.000000000 +0200
+++ linux-2.6.9/net/core/dev.c	2004-11-30 11:46:39.000000000 +0100
@@ -1094,9 +1094,15 @@ void dev_queue_xmit_nit(struct sk_buff *
 				skb2->nh.raw = skb2->data;
 			}
 
+			/* The packet handler may expect BHs to be disabled,
+			 * so don't let them down */
+			local_bh_disable();
+
 			skb2->h.raw = skb2->nh.raw;
 			skb2->pkt_type = PACKET_OUTGOING;
 			ptype->func(skb2, skb->dev, ptype);
+
+			local_bh_enable();
 		}
 	}
 	rcu_read_unlock();