Subject: Re: [PATCH] Phonet: hold socket before giving it to sk_deliver_skb()

From: Eric Dumazet <[email-masked]>
Date: Thu, 15 Oct 2009 16:52:19 +0200

Rémi Denis-Courmont a écrit :
> From: Rémi Denis-Courmont <[email-masked]>
> 
> Signed-off-by: Rémi Denis-Courmont <[email-masked]>
> ---
>  net/phonet/socket.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/net/phonet/socket.c b/net/phonet/socket.c
> index 8c84190..0412beb 100644
> --- a/net/phonet/socket.c
> +++ b/net/phonet/socket.c
> @@ -112,8 +112,10 @@ void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb)
>  			continue;
>  
>  		clone = skb_clone(skb, GFP_ATOMIC);
> -		if (clone)
> +		if (clone) {
> +			sock_hold(sknode);
>  			sk_receive_skb(sknode, clone, 0);
> +		}
>  	}
>  	spin_unlock(&pnsocks.lock);
>  }

Indeed sk_receive_skb() does a sock_put(sk)

Acked-by: Eric Dumazet <[email-masked]>