netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix null dereference in ip_defrag
@ 2008-03-21 19:09 Phil Oester
  2008-03-21 22:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Oester @ 2008-03-21 19:09 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

Been seeing occasional panics in my testing of 2.6.25-rc in ip_defrag.
Offending line in ip_defrag is here:

	net = skb->dev->nd_net

where dev is NULL.  Bisected the problem down to commit
ac18e7509e7df327e30d6e073a787d922eaf211d ([NETNS][FRAGS]: Make the
inet_frag_queue lookup work in namespaces).  

Below patch (idea from Patrick McHardy) fixes the problem for me.

Signed-off-by: Phil Oester <kernel@linuxace.com>
Acked-by: Patrick McHardy <kaber@trash.net>

Phil



[-- Attachment #2: patch-ipfrags --]
[-- Type: text/plain, Size: 480 bytes --]

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index a2e92f9..3b2e5ad 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -568,7 +568,7 @@ int ip_defrag(struct sk_buff *skb, u32 user)
 
 	IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
 
-	net = skb->dev->nd_net;
+	net = skb->dev ? skb->dev->nd_net : skb->dst->dev->nd_net;
 	/* Start by cleaning up the memory. */
 	if (atomic_read(&net->ipv4.frags.mem) > net->ipv4.frags.high_thresh)
 		ip_evictor(net);

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

* Re: [PATCH] Fix null dereference in ip_defrag
  2008-03-21 19:09 [PATCH] Fix null dereference in ip_defrag Phil Oester
@ 2008-03-21 22:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-03-21 22:00 UTC (permalink / raw)
  To: kernel; +Cc: netdev

From: Phil Oester <kernel@linuxace.com>
Date: Fri, 21 Mar 2008 12:09:30 -0700

> Been seeing occasional panics in my testing of 2.6.25-rc in ip_defrag.
> Offending line in ip_defrag is here:
> 
> 	net = skb->dev->nd_net
> 
> where dev is NULL.  Bisected the problem down to commit
> ac18e7509e7df327e30d6e073a787d922eaf211d ([NETNS][FRAGS]: Make the
> inet_frag_queue lookup work in namespaces).  
> 
> Below patch (idea from Patrick McHardy) fixes the problem for me.
> 
> Signed-off-by: Phil Oester <kernel@linuxace.com>
> Acked-by: Patrick McHardy <kaber@trash.net>

Thanks, I had this in my queue and will apply this now.

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

end of thread, other threads:[~2008-03-21 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-21 19:09 [PATCH] Fix null dereference in ip_defrag Phil Oester
2008-03-21 22:00 ` 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).