public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: pabeni@redhat.com, davem@davemloft.net,
	allison.henderson@oracle.com,
	syzbot+5efae91f60932839f0a5@syzkaller.appspotmail.com,
	kuba@kernel.org, rds-devel@oss.oracle.com,
	gerd.rausch@oracle.com, netdev@vger.kernel.org,
	edumazet@google.com, linux-rdma@vger.kernel.org
Subject: Re: [net,v2] net/rds: fix recursive lock in rds_tcp_conn_slots_available
Date: Thu, 19 Feb 2026 08:44:58 +0000	[thread overview]
Message-ID: <aZbNirXFABxg-Fwk@horms.kernel.org> (raw)
In-Reply-To: <59c133d4-9e5c-4eee-95c2-4a8877b052be@suse.de>

On Wed, Feb 18, 2026 at 06:13:56PM +0100, Fernando Fernandez Mancera wrote:
> On 2/18/26 11:02 AM, Simon Horman wrote:

...

> > The commit message states "For rds_tcp_conn_slots_available() the lock is
> > already held because we are in the receiving path." Is this claim accurate
> > across all receive paths?
> > 
> > Looking at the two receive sub-paths:
> > 
> > 1. In the backlog processing path (shown in the syzbot stack trace), the
> > socket IS owned because __release_sock() runs while the lock_sock
> > ownership bit is still set:
> > 
> > tcp_sock_set_cork() -> lock_sock() -> release_sock() -> __release_sock()
> >    -> sk_backlog_rcv() -> tcp_v6_do_rcv() -> tcp_rcv_established()
> >    -> tcp_data_ready() -> sk->sk_data_ready() -> rds_tcp_data_ready()
> >    -> rds_tcp_read_sock()
> > 
> > 2. However, rds_tcp_data_ready() can also be called directly from the
> > normal softirq receive path via tcp_data_ready() -> sk->sk_data_ready(),
> > where the socket lock is NOT held. In this path, rds_tcp_read_sock()
> > calls tcp_read_sock() without lock_sock.
> > 
> > The fix is still correct in both cases because inet_dport is a stable
> > atomic-width field, but the claim "the lock is already held" is not
> > universally true for all receiving paths.
> > 
> > Should the commit message be more precise about when the lock is held?
> > 
> 
> While I think that is right, the relevant part is the atomicity. The
> operation is safe but it requires a READ_ONCE() annotation probably.

Thanks. I don't have a deep understanding of this.
But I agree that seems correct.

      parent reply	other threads:[~2026-02-19  8:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 22:38 [PATCH net v2] net/rds: fix recursive lock in rds_tcp_conn_slots_available Fernando Fernandez Mancera
2026-02-17 22:47 ` Gerd Rausch
2026-02-18 10:02 ` [net,v2] " Simon Horman
2026-02-18 17:13   ` Fernando Fernandez Mancera
2026-02-18 20:08     ` Allison Henderson
2026-02-19  8:44     ` Simon Horman [this message]

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=aZbNirXFABxg-Fwk@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=allison.henderson@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fmancera@suse.de \
    --cc=gerd.rausch@oracle.com \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rds-devel@oss.oracle.com \
    --cc=syzbot+5efae91f60932839f0a5@syzkaller.appspotmail.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