Re: Regression, bisected: reference leak with IPSec since ~2.6.31

From: Jarek Poplawski
Date: Tue Sep 21 2010 - 05:39:07 EST


On Tue, Sep 21, 2010 at 11:21:00AM +0200, Eric Dumazet wrote:
> Le mardi 21 septembre 2010 ?? 09:12 +0000, Jarek Poplawski a écrit :
> > On 2010-09-20 23:31, Eric Dumazet wrote:
> > ...
> > > @@ -510,11 +509,13 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
> > > goto slow_path;
> > >
> > > BUG_ON(frag->sk);
> > > - if (skb->sk) {
> > > + }
> > > + if (skb->sk) {
> > > + skb_walk_frags(skb, frag) {
> > > frag->sk = skb->sk;
> > > frag->destructor = sock_wfree;
> >
> > Nice catch, but it seems doing it in the first loop as now, and
> > reverting changes before goto slow_path might be more optimal here.
> >
>
> I thought of this, but found this function already very complex.
>
> Once everything is in cpu caches, the added loop is very cheap.

I hope you're right with this.

>
> I liked the :
>
> <check everything without changing state>
> if something wrong
> goto slow_path
> else
> <OK, lets do destructive things>
>

But it's an optimization of the "unlikely" case btw. ;-)

Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/