summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin
diff options
context:
space:
mode:
authorSiddharth Chintamaneni <sidchintamaneni@gmail.com>2026-11-14 16:26:31 +0000
committerJakub Kicinski <kuba@kernel.org>2026-11-17 18:53:44 -0800
commit2c0d5e36aaf3cee1bc53c761704202b845be54d6 (patch)
tree4cbfc78d55c73f6f8c16486dd1384ad6abeb0c4e /tools/perf/scripts/python/bin
parent8a55761cec691ff5f67d9c009e7488fe063c9287 (diff)
af_unix: Fix scm_stat.nr_fds leak in unix_dgram_disconnected().
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> Link: https://patch.msgid.link/20261114162632.16346-2-sidchintamaneni@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions