From: Jakub Kicinski <kuba@kernel.org>
To: John Ericson <John.Ericson@Obsidian.Systems>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
John Ericson <mail@johnericson.me>,
Simon Horman <horms@kernel.org>,
Christian Brauner <brauner@kernel.org>,
David Rheinsberg <david@readahead.eu>,
Cong Wang <cwang@multikernel.io>,
Sergei Zimmerman <sergei@zimmerman.foo>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3 1/2] af_unix: fix listen() succeeding on sockets in the wrong state
Date: Thu, 23 Jul 2026 09:12:48 -0700 [thread overview]
Message-ID: <20260723091248.6acaa173@kernel.org> (raw)
In-Reply-To: <20260718182903.2295560-1-John.Ericson@Obsidian.Systems>
On Sat, 18 Jul 2026 14:29:01 -0400 John Ericson wrote:
> Commit fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for
> reaped sk->sk_peer_pid") inserted a prepare_peercred() call between err
> = -EINVAL and the socket-state check in unix_listen(). Since
> prepare_peercred() leaves err at 0 on success, listen() on an AF_UNIX
> socket that is not in TCP_CLOSE or TCP_LISTEN state (e.g. one that is
> already connected) now silently returns success without doing anything,
> instead of failing with EINVAL as it did before.
As the bug proves this
err = x
if (cond)
goto bla;
is a fragile pattern. People do this to avoid the extra braces AFAIU
but it's not worth it. Can you move the error setting before the jumps
please?
if (cond) {
err = x;
goto bla;
}
--
pw-bot: cr
next prev parent reply other threads:[~2026-07-23 16:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 18:29 [PATCH net v3 1/2] af_unix: fix listen() succeeding on sockets in the wrong state John Ericson
2026-07-18 18:29 ` [PATCH net v3 2/2] selftests/net/af_unix: test listen() rejects wrong socket states John Ericson
2026-07-23 16:12 ` Jakub Kicinski [this message]
2026-07-23 20:58 ` [PATCH net v3 1/2] af_unix: fix listen() succeeding on sockets in the wrong state John Ericson
2026-07-24 22:09 ` Jakub Kicinski
2026-07-24 22:20 ` patchwork-bot+netdevbpf
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=20260723091248.6acaa173@kernel.org \
--to=kuba@kernel.org \
--cc=John.Ericson@Obsidian.Systems \
--cc=brauner@kernel.org \
--cc=cwang@multikernel.io \
--cc=davem@davemloft.net \
--cc=david@readahead.eu \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@johnericson.me \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sergei@zimmerman.foo \
/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