[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070227.100052.59655152.davem@davemloft.net>
Date: Tue, 27 Feb 2007 10:00:52 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: paul.moore@...com
Cc: kaber@...sh.net, netdev@...r.kernel.org, acme@...stprotocols.net
Subject: Re: [NET]: Fix kfree(skb)
From: Paul Moore <paul.moore@...com>
Date: Tue, 27 Feb 2007 12:35:22 -0500
> On Tuesday, February 27 2007 12:06:32 pm Patrick McHardy wrote:
> > diff --git a/net/netlabel/netlabel_unlabeled.c
> > b/net/netlabel/netlabel_unlabeled.c index 5bc3718..b931ede 100644
> > --- a/net/netlabel/netlabel_unlabeled.c
> > +++ b/net/netlabel/netlabel_unlabeled.c
> > @@ -173,7 +173,7 @@ static int netlbl_unlabel_list(struct sk
> > return 0;
> >
> > list_failure:
> > - kfree(ans_skb);
> > + kfree_skb(ans_skb);
> > return ret_val;
> > }
>
> Acked-by: Paul Moore <paul.moore@...com>
>
> Thanks for catching this, it looks like I used kfree_skb() elsewhere but for
> some reason missed it here.
It's unfortunately an easy mistake to make since kfree() accepts any
pointer type without warning.
What would be really nice is if someone could come up with a way for
kfree() to disallow being passed objects that are meant to be released
via some other mechanism. So that, for example:
kfree(skb);
would warn or fail to compile, but the kfree_skb() code could go:
kmem_cache_free_I_KNOW_WHAT_I_AM_DOING(skbuff_head_cache, skb);
:-)
-
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