Re: [PATCH] UML - Correctly handle skb allocation failures

2007-09-27 Thread Jeff Dike
On Thu, Sep 27, 2007 at 04:53:40PM -0700, Andrew Morton wrote: > Still wanna know why it is safe for uml_net_rx to be playing with > drop_skb when update_drop_skb() could be concurrently reallocating > and freeing it. Ah, yes, I missed that point in the horror of my botch last night. I'll add

Re: [PATCH] UML - Correctly handle skb allocation failures

2007-09-27 Thread Andrew Morton
On Thu, 27 Sep 2007 13:01:26 -0400 Jeff Dike <[EMAIL PROTECTED]> wrote: > +static int update_drop_skb(int max) > +{ > + struct sk_buff *new; > + int err = 0; > + > + spin_lock(_lock); > + > + if (max <= drop_max) > + goto out; > + > + err = -ENOMEM; > + new =

[PATCH] UML - Correctly handle skb allocation failures

2007-09-27 Thread Jeff Dike
Handle memory allocation failures when reading packets. We have to read something from the host, even if we can't allocate any memory. If we don't, the host side of the device may fill up and stop delivering interrupts because no new packets can be queued. A single sk_buff is allocated whenever

[PATCH] UML - Correctly handle skb allocation failures

2007-09-27 Thread Jeff Dike
Handle memory allocation failures when reading packets. We have to read something from the host, even if we can't allocate any memory. If we don't, the host side of the device may fill up and stop delivering interrupts because no new packets can be queued. A single sk_buff is allocated whenever

Re: [PATCH] UML - Correctly handle skb allocation failures

2007-09-27 Thread Jeff Dike
On Thu, Sep 27, 2007 at 04:53:40PM -0700, Andrew Morton wrote: Still wanna know why it is safe for uml_net_rx to be playing with drop_skb when update_drop_skb() could be concurrently reallocating and freeing it. Ah, yes, I missed that point in the horror of my botch last night. I'll add

Re: [PATCH] UML - Correctly handle skb allocation failures

2007-09-27 Thread Andrew Morton
On Thu, 27 Sep 2007 13:01:26 -0400 Jeff Dike [EMAIL PROTECTED] wrote: +static int update_drop_skb(int max) +{ + struct sk_buff *new; + int err = 0; + + spin_lock(drop_lock); + + if (max = drop_max) + goto out; + + err = -ENOMEM; + new =