[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <186c6a78-dfab-6dc0-8a7b-0d9303811a4d@gmail.com>
Date: Tue, 23 Apr 2019 15:12:14 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Howells <dhowells@...hat.com>,
Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH v2 net] rxrpc: fix race condition in rxrpc_input_packet()
On 04/23/2019 03:06 PM, David Howells wrote:
> Eric Dumazet <edumazet@...gle.com> wrote:
>
>> @@ -1161,19 +1161,15 @@ int rxrpc_extract_header(struct rxrpc_skb_priv *sp, struct sk_buff *skb)
>> * handle data received on the local endpoint
>> * - may be called in interrupt context
>> *
>> - * The socket is locked by the caller and this prevents the socket from being
>> - * shut down and the local endpoint from going away, thus sk_user_data will not
>> - * be cleared until this function returns.
>> - *
>
> I'd prefer not to remove the comment entirely. Could it be changed to:
>
> * [!] Note that as this is called from the encap_rcv hook, the socket is not
> * held locked by the caller and nothing prevents sk_user_data on the UDP from
> * being cleared in the middle of processing this function.
Okay, but really rcu_dereference_sk_user_data() should be self-documenting/explaining.
>
>> @@ -1181,6 +1177,10 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb)
>>
>> _enter("%p", udp_sk);
>>
>> + if (unlikely(!local)) {
>> + kfree_skb(skb);
>> + return 0;
>> + }
>
> This looks better, thanks.
>
> David
>
Powered by blists - more mailing lists