Fix null dereference in ip_defrag
Subsystems (3)
PATCH 1/1 Fix null dereference in ip_defrag
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.
Phil
net/ipv4/ip_fragment.c +1 -1
@@ -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);
David Miller
maintainerFrom: Phil Oester <[email protected]>
Date: Fri, 21 Mar 2008 12:09:30 -0700
Quoted 5 lines
Been seeing occasional panics in my testing of 2.6.25-rc in
ip_defrag. Offending line inip_defragis here:net = skb->dev->nd_net
Quoted 8 lines
where dev is NULL. Bisected the problem down to commit
ac18e7509e7df327e30d6e073a787d922eaf211d([NETNS][FRAGS]: Make theinet_frag_queuelookup work in namespaces).Below patch (idea from Patrick McHardy) fixes the problem for me.
Signed-off-by Phil Oester <[email protected]>Acked-by Patrick McHardy <[email protected]>
Thanks, I had this in my queue and will apply this now.