Subject: Re: [PATCH] net: add destructor for skb data.

From: Rusty Russell <[email-masked]>
Date: Mon, 7 Apr 2008 07:10:12 +1000

On Sunday 06 April 2008 19:20:18 Evgeniy Polyakov wrote:
> Hi Rusty.
>
> On Sun, Apr 06, 2008 at 01:20:59PM +1000, Rusty Russell 
([email-masked]) wrote:
> >     I don't think so.  For a start, the skb destructor is called while
> > the skb is still in the socket queue (ie. the data is still live). 
> > Secondly, the original skb can be freed while clones still reference the
> > data.
>
> That is what it is for - to remove data from any queues and free it.
> One can check if skb was cloned and do not perform some steps, instead
> call old destructor. Destructor for the last clone will cleanup whatever
> is needed. Thoughts?

The old destructor is in some other skb, you'd have to carry it around.  
And skb_orphan() calls the destructor early deliberately.

The current skb destructor is for the sk_buff, not the data.  It's clearest to 
keep them separate.

Cheers,
Rusty.