[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1302582172.3603.18.camel@edumazet-laptop>
Date: Tue, 12 Apr 2011 06:22:52 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Scot Doyle <lkml@...tdoyle.com>
Cc: Stephen Hemminger <shemminger@...tta.com>,
Hiroaki SHIMODA <shimoda.hiroaki@...il.com>,
netdev@...r.kernel.org
Subject: Re: Kernel panic when using bridge
Le mardi 12 avril 2011 à 06:09 +0200, Eric Dumazet a écrit :
> Le lundi 11 avril 2011 à 22:47 -0500, Scot Doyle a écrit :
> > On 04/11/2011 08:31 PM, Stephen Hemminger wrote:
> > >
> > > It would help if you gave a little more context (like diff -up)
> > > next time.
> > >
> > > I think the correct fix is for the skb handed to ip_compile_options
> > > to match the layout expected by ip_compile_options.
> > >
> > > This patch is compile tested only, please validate.
> > >
> > >
> > > Subject: [PATCH] bridge: set pseudo-route table before calling ip_comple_options
> > >
> > > For some ip options, ip_compile_options assumes it can find the associated
> > > route table. The bridge to iptables code doesn't supply the necessary
> > > reference causing NULL dereference.
> > >
> > > Signed-off-by: Stephen Hemminger<shemminger@...tta.com>
> > >
> > > ---
> > > Patch against net-next-2.6, but if validated should go to net-2.6
> > > and stable.
> > >
> > > --- a/net/bridge/br_netfilter.c 2011-04-11 18:18:22.534837859 -0700
> > > +++ b/net/bridge/br_netfilter.c 2011-04-11 18:25:15.427244826 -0700
> > > @@ -221,6 +221,7 @@ static int br_parse_ip_options(struct sk
> > > struct ip_options *opt;
> > > struct iphdr *iph;
> > > struct net_device *dev = skb->dev;
> > > + struct rtable *rt;
> > > u32 len;
> > >
> > > iph = ip_hdr(skb);
> > > @@ -255,6 +256,14 @@ static int br_parse_ip_options(struct sk
> > > return 0;
> > > }
> > >
> > > + /* Associate bogus bridge route table */
> > > + rt = bridge_parent_rtable(dev);
> > > + if (!rt) {
> > > + kfree_skb(skb);
> > > + return 0;
> > > + }
> > > + skb_dst_set(skb,&rt->dst);
>
> Please try skb_dst_set_noref() here instead of skb_dst_set()
>
> Or increment rt refcount.
Also, I would first check if skb->dst already set to not leak a dst
if (!skb->dst) {
rt = bridge_parent_rtable(dev);
if (!rt) {
kfree_skb(skb);
return 0;
}
skb_dst_set_noref(skb,&rt->dst);
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists