From: Kuniyuki Iwashima <kuniyu@google.com>
To: Siddharth Chintamaneni <sidchintamaneni@gmail.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>,
Shuah Khan <shuah@kernel.org>, Kirill Tkhai <tkhai@ya.ru>,
apais@microsoft.com, hargar@linux.microsoft.com,
rlmenge@gmail.com, egoriluk@gmail.com, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] af_unix: Fix scm_stat.nr_fds leak in unix_dgram_disconnected().
Date: Sat, 14 Nov 2026 07:33:12 +0000 [thread overview]
Message-ID: <avgOk7BctoXaaoZx@google.com> (raw)
In-Reply-To: <20261111225148.88506-2-sidchintamaneni@gmail.com>
On Wed, 11 Nov 2026 22:51:47 +0000, Siddharth Chintamaneni wrote:
> When a connected SOCK_DGRAM socket disconnects (e.g. via connect() with
> AF_UNSPEC), reconnects to a different peer, or observes a dead peer in
> unix_dgram_sendmsg(), unix_dgram_disconnected() purges all unread
> datagrams from sk->sk_receive_queue via skb_queue_purge_reason().
>
> Because skb_queue_purge_reason() frees each skb without calling
> scm_stat_del(sk, skb), any SCM_RIGHTS file descriptors attached to the
> purged skbs remain permanently accounted in u->scm_stat.nr_fds (reported
> as scm_fds in /proc/<pid>/fdinfo/<fd>) for the remaining lifetime of the
> socket.
>
> Move scm_stat_add() and scm_stat_del() above unix_dgram_disconnected(),
> splice sk->sk_receive_queue onto a local list under the queue lock, and
> call scm_stat_del() before kfree_skb_reason() on each purged skb.
>
> Fixes: 3c32da19a858 ("unix: Show number of pending scm files of receive queue in fdinfo")
> Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
next prev parent reply other threads:[~2026-11-14 7:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 22:51 [PATCH net v2 0/2] " Siddharth Chintamaneni
2026-11-11 22:51 ` [PATCH net v2 1/2] " Siddharth Chintamaneni
2026-11-14 7:33 ` Kuniyuki Iwashima [this message]
2026-11-11 22:51 ` [PATCH net v2 2/2] selftest: af_unix: Test scm_fds on dgram disconnect Siddharth Chintamaneni
2026-11-14 7:53 ` Kuniyuki Iwashima
2026-11-11 22:57 ` [PATCH net v2 0/2] af_unix: Fix scm_stat.nr_fds leak in unix_dgram_disconnected() netdev-bot+sinfo
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=avgOk7BctoXaaoZx@google.com \
--to=kuniyu@google.com \
--cc=apais@microsoft.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=egoriluk@gmail.com \
--cc=hargar@linux.microsoft.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rlmenge@gmail.com \
--cc=shuah@kernel.org \
--cc=sidchintamaneni@gmail.com \
--cc=tkhai@ya.ru \
/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®