netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, kernel-team@cloudflare.com,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Haowei Yan <g1042620637@gmail.com>,
	Tom Parkin <tparkin@katalix.com>
Subject: Re: [PATCH net v2] l2tp: Serialize access to sk_user_data with sock lock
Date: Wed, 17 Aug 2022 16:33:33 +0200	[thread overview]
Message-ID: <87edxfvsxs.fsf@cloudflare.com> (raw)
In-Reply-To: <20220816184150.78d6e3e3@kernel.org>

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.

  reply	other threads:[~2022-08-17 14:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 13:01 [PATCH net v2] l2tp: Serialize access to sk_user_data with sock lock Jakub Sitnicki
2022-08-15 13:21 ` Tom Parkin
2022-08-15 13:26   ` Jakub Sitnicki
2022-08-15 13:39     ` Tom Parkin
2022-08-17  1:41 ` Jakub Kicinski
2022-08-17 14:33   ` Jakub Sitnicki [this message]
2022-08-17 15:51     ` Jakub Kicinski
2022-08-17 15:56       ` Jakub Sitnicki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edxfvsxs.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=g1042620637@gmail.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tparkin@katalix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).