mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [????] Re: [PATCH] af_unix: Fix wrong socket tested in the symmetric half of unix_state_lock_cmp_fn().
Date: Mon, 9 Nov 2026 05:19:15 +0000	[thread overview]
Message-ID: <06faaaea248d4cefb1f12d1221b75a8a@baidu.com> (raw)
In-Reply-To: <au7bGHqwhXXttXH_@google.com>


> > [PATCH] af_unix: Fix wrong socket tested in the symmetric half
> 
> This is net-next material, so it should be
> 
>   [PATCH net-next vX] af_unix: ...
> 
> see Documentation/process/maintainer-netdev.rst.
> 
> 
> On Sat, 07 Nov 2026 04:18:22 +0800, lirongqing wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> >
> > The second half of unix_state_lock_cmp_fn() is meant to mirror the
> > first one with the roles of a and b swapped, but it switches on b's
> > state again:
> >
> > 	if (b->sk.sk_state == TCP_LISTEN) {
> > 		switch (b->sk.sk_state) {
> > 		case TCP_CLOSE:
> > 		case TCP_ESTABLISHED:
> > 			return 1;
> >
> > The enclosing if already established that b is TCP_LISTEN, so the
> > switch can only reach the default label and the branch always returns
> > 0, "no order known", instead of the intended 1.
> >
> > Test a's state, as the first half does.  The code is only compiled
> > with CONFIG_PROVE_LOCKING, so there is no runtime memory-safety
> > impact; the effect is that lockdep cannot validate this nesting order
> > of unix_state_lock().
> >
> > Fixes: 98f706de445b ("af_unix: Define locking order for U_LOCK_SECOND
> > in unix_stream_connect().")
> 
> Please drop the tag.
> 
> As commented, the branch never hits and no real issue exists, not worth
> backporting.
> 

Ok, I will send v2

[Li,Rongqing] 

> 
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >  net/unix/af_unix.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index
> > e7a0582..501e693 100644
> > --- a/net/unix/af_unix.c
> > +++ b/net/unix/af_unix.c
> > @@ -163,7 +163,7 @@ static int unix_state_lock_cmp_fn(const struct
> > lockdep_map *_a,
> >
> >  	/* Should never happen.  Just to be symmetric. */
> >  	if (b->sk.sk_state == TCP_LISTEN) {
> > -		switch (b->sk.sk_state) {
> > +		switch (a->sk.sk_state) {
> >  		case TCP_CLOSE:
> >  		case TCP_ESTABLISHED:
> >  			return 1;
> > --
> > 2.9.4
> >

      reply	other threads:[~2026-11-09  5:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 20:18 lirongqing
2026-11-06 20:22 ` netdev-bot+sinfo
2026-11-07  8:08 ` Kuniyuki Iwashima
2026-11-09  5:19   ` Li,Rongqing [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=06faaaea248d4cefb1f12d1221b75a8a@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®