[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87edxfvsxs.fsf@cloudflare.com>
Date: Wed, 17 Aug 2022 16:33:33 +0200
From: Jakub Sitnicki <jakub@...udflare.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, kernel-team@...udflare.com,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Haowei Yan <g1042620637@...il.com>,
Tom Parkin <tparkin@...alix.com>
Subject: Re: [PATCH net v2] l2tp: Serialize access to sk_user_data with sock
lock
On Tue, Aug 16, 2022 at 06:41 PM -07, Jakub Kicinski wrote:
> On Mon, 15 Aug 2022 15:01:07 +0200 Jakub Sitnicki wrote:
>> sk->sk_user_data has multiple users, which are not compatible with each
>> other. To synchronize the users, any check-if-unused-and-set access to the
>> pointer has to happen with sock lock held.
>>
>> l2tp currently fails to grab the lock when modifying the underlying tunnel
>> socket. Fix it by adding appropriate locking.
>>
>> We don't to grab the lock when l2tp clears sk_user_data, because it happens
>> only in sk->sk_destruct, when the sock is going away.
>
> Note to other netdev maintainers that based on the discussion about
> the reuseport locking it's unclear whether we shouldn't also take
> the callback lock...
You're right. reuseport_array, psock, and kcm protect sk_user_data with
the callback lock, not the sock lock. Need to fix it.
Powered by blists - more mailing lists