From: Daehyeon Ko <4ncienth@gmail.com>
To: Tung Quang Nguyen <tung.quang.nguyen@est.tech>
Cc: netdev@vger.kernel.org, Jon Maloy <jmaloy@redhat.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Daehyeon Ko <4ncienth@gmail.com>
Subject: Re: [PATCH net] tipc: clear sock->sk on the failed-insert path in tipc_sk_create()
Date: Mon, 13 Jul 2026 16:43:24 +0900 [thread overview]
Message-ID: <20260713074324.3577116-1-4ncienth@gmail.com> (raw)
In-Reply-To: <GV1P189MB1988AF0F2722101E30D902E1C6FA2@GV1P189MB1988.EURP189.PROD.OUTLOOK.COM>
Hi Tung,
Thanks for reproducing and testing. Decoded with scripts/decode_stacktrace.sh
(line numbers are current mainline net/tipc/socket.c / net/core/sock.c /
net/socket.c):
BUG: KASAN: slab-use-after-free in lock_sock_nested (net/core/sock.c:3839)
Write of size 8 at addr ffff8880047cdc38 by task init/1
Call Trace:
lock_sock_nested (include/linux/instrumented.h:112 net/core/sock.c:3839)
tipc_release (include/net/sock.h:1713 net/tipc/socket.c:638) // lock_sock(sk)
__sock_release (net/socket.c:710)
sock_close (net/socket.c:1501)
__fput (fs/file_table.c:512)
Allocated by task 1:
sk_alloc (net/core/sock.c:2308)
tipc_sk_create (net/tipc/socket.c:487) // sk = sk_alloc(...)
tipc_accept (net/tipc/socket.c:2744)
do_accept (net/socket.c:2034)
Freed by task 1:
__sk_destruct (net/core/sock.c:2289 net/core/sock.c:2391)
tipc_sk_create (net/tipc/socket.c:504) // sk_free(sk) on the tipc_sk_insert() failure path
tipc_accept (net/tipc/socket.c:2744)
do_accept (net/socket.c:2034)
So the same sk is allocated at socket.c:487, freed at socket.c:504 (the
sk_free() right before the line this patch adds), and then written at
socket.c:638 (lock_sock()) from tipc_release() on the accept() fput cleanup.
Thanks,
Daehyeon
next prev parent reply other threads:[~2026-07-13 7:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 1:44 [PATCH net] tipc: clear sock->sk on the failed-insert path in tipc_sk_create() Daehyeon Ko
2026-07-10 3:30 ` Tung Quang Nguyen
2026-07-10 5:48 ` Daehyeon Ko
2026-07-13 5:01 ` Tung Quang Nguyen
2026-07-13 7:43 ` Daehyeon Ko [this message]
2026-07-13 7:52 ` Tung Quang Nguyen
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=20260713074324.3577116-1-4ncienth@gmail.com \
--to=4ncienth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tung.quang.nguyen@est.tech \
/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