login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
September
»
27
Re: [PATCH] UML - Correctly handle skb allocation failures
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Andrew Morton <akpm@...>
To: Jeff Dike <jdike@...>
Cc: <linux-kernel@...>, <user-mode-linux-devel@...>
Subject:
Re: [PATCH] UML - Correctly handle skb allocation failures
Date: Thursday, September 27, 2007 - 7:53 pm
On Thu, 27 Sep 2007 13:01:26 -0400 Jeff Dike <jdike@addtoit.com> wrote:
quoted text
> +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 = dev_alloc_skb(max); > + if (new == NULL) > + goto out; > + > + skb_put(new, max); > + > + kfree_skb(drop_skb); > + drop_skb = new; > + drop_max = max; > + err = 0; > +out: > + spin_unlock(&drop_lock); > + > + return err; > +} > + > static int uml_net_rx(struct net_device *dev) > { > struct uml_net_private *lp = dev->priv; > @@ -43,6 +82,9 @@ static int uml_net_rx(struct net_device > /* If we can't allocate memory, try again next round. */ > skb = dev_alloc_skb(lp->max_packet); > if (skb == NULL) { > + drop_skb->dev = dev; > + /* Read a packet into drop_skb and don't do anything with it. */ > + (*lp->read)(lp->fd, drop_skb, lp); > lp->stats.rx_dropped++; > return 0;
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. -
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] UML - Correctly handle skb allocation failures
, Jeff Dike
, (Thu Sep 27, 1:01 pm)
Re: [PATCH] UML - Correctly handle skb allocation failures
, Andrew Morton
, (Thu Sep 27, 7:53 pm)
Re: [PATCH] UML - Correctly handle skb allocation failures
, Jeff Dike
, (Thu Sep 27, 9:21 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg Kroah-Hartman
[PATCH 008/196] Chinese: add translation of volatile-considered-harmful.txt
Amit K. Arora
[RFC] Heads up on sys_fallocate()
Bart Van Assche
Integration of SCST in the mainstream Linux kernel
Linus Torvalds
Re: Slow DOWN, please!!!
git
:
linux-netdev
:
Gerrit Renker
[PATCH 0/37] dccp: Feature negotiation - last call for comments
David Miller
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
David Miller
[GIT]: Networking
Natalie Protasevich
[BUG] New Kernel Bugs
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
0 users
and
493 guests
online.
Syndicate