netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make dev_kfree_skb_any check if the skb is valid
@ 2007-04-18 22:33 Erik Hovland
  2007-04-18 22:44 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Hovland @ 2007-04-18 22:33 UTC (permalink / raw)
  To: netdev; +Cc: trivial

If dev_kfree_skb_any is called and it then calls dev_kfree_skb_irq.
That call will dereference the skb. If the skb is invalid, down the
drain we go.

This one-liner checks to see if the skb is valid as part of the
determination of whether to call dev_kfree_skb_irq.

Signed-off-by: Erik Hovland <erik@hovland.org>

---

 net/core/dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 4dc93cc..85f4a4c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1131,7 +1131,7 @@ EXPORT_SYMBOL(__netif_rx_schedule);
 
 void dev_kfree_skb_any(struct sk_buff *skb)
 {
-	if (in_irq() || irqs_disabled())
+	if (skb && (in_irq() || irqs_disabled()))
 		dev_kfree_skb_irq(skb);
 	else
 		dev_kfree_skb(skb);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-18 23:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18 22:33 [PATCH] Make dev_kfree_skb_any check if the skb is valid Erik Hovland
2007-04-18 22:44 ` David Miller
2007-04-18 23:18   ` Erik Hovland
2007-04-18 23:27     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).