netdev
[Top] [All Lists]

Re: [PATCH] netlink: defer socket destruction a bit

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] netlink: defer socket destruction a bit
From: Tommy Christensen <tommy.christensen@xxxxxxxxx>
Date: Thu, 12 May 2005 11:57:01 +0200
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, Ken-ichirou MATSUZAWA <chamas@xxxxxxxxxxxxx>
In-reply-to: <20050511230309.GA21547@gondor.apana.org.au>
References: <428284D6.9000804@tpack.net> <20050511222421.GA21331@gondor.apana.org.au> <4282889A.7080409@tpack.net> <20050511230309.GA21547@gondor.apana.org.au>
Sender: netdev-bounce@xxxxxxxxxxx
On Thu, 2005-05-12 at 01:03, Herbert Xu wrote:
> On Thu, May 12, 2005 at 12:35:06AM +0200, Tommy Christensen wrote:
> > 
> > No, skb2 cannot be shared with a listening socket. As I read the code,
> > it can only be non-null when delivery has failed.
> 
> What about this code path:
> 
> 1) skb2 = skb, refcnt++.
> 2) Devliered to socket 1.
> 3) Socket 1 frees skb through recvmsg.
> 4) skb2 = skb, refcnt++.
> 5) Delivery fails.
> 
> Now skb2 is identical to skb and they both refer to socket 1.

You're right, Herbert.  The interception by recvmsg has to be
considered in this case also.  Tricky.

I moved the call to skb_orphan in the other patch, as you
suggested.  I think that also makes this patch safe as it is.

Right?

-Tommy



<Prev in Thread] Current Thread [Next in Thread>