🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Wentao Liang Wed, 04 Nov 2026 02:28
[PATCH] net/x25: release the route on a nonblocking connect
#10748
Author: Wentao Liang
Date: Wed, 04 Nov 2026 02:28
35 lines
9150 bytes
x25_connect() takes a reference on the route with x25_get_route() and
drops it at out_put_route.  The nonblocking path after
x25_write_internal() jumps straight to out instead, so the reference
is leaked on every nonblocking connect.

That path cannot use out_put_neigh because the neighbour is still
needed by the pending call, but the route is no longer referenced
once the neighbour has been looked up.

Jump to out_put_route so only the route reference is dropped.

Fixes: e21dba7a4df4 ("net/x25: fix nonblocking connect")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 net/x25/af_x25.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index f45c9ec7d2c6..89e0f247c5b1 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -812,7 +812,7 @@ static int x25_connect(struct socket *sock, struct sockaddr_unsized *uaddr,
 	/* Now the loop */
 	rc = -EINPROGRESS;
 	if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK))
-		goto out;
+		goto out_put_route;
 
 	rc = x25_wait_for_connection_establishment(sk);
 	if (rc)
-- 
2.34.1
Re: [PATCH] net/x25: release the route on a nonblocking connect
#10755
Author: netdev-bot+sinfo
Date: Wed, 04 Nov 2026 02:32
22 lines
8648 bytes
Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by code inspection). If it was triggered please include
   the symptoms, like the stack trace or error messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Re: [PATCH] net/x25: release the route on a nonblocking connect
#21201
Author: Martin Schiller
Date: Mon, 23 Nov 2026 17:44
36 lines
10840 bytes
On Wed, 04 Nov 2026 03:32:58 +0100, netdev-bot wrote:
> - Whether the issue was actually triggered, or is only theoretical
>   (e.g. found by code inspection). If it was triggered please include
>   the symptoms, like the stack trace or error messages.

It is real and easy to trigger: every nonblocking connect() leaks one
reference on the route. After a single nonblocking connect() and
deleting the route with SIOCDELRT, kmemleak reports the route:

  unreferenced object 0xffff8880008cf940 (size 64):
    comm "x25test", pid 26, jiffies 4294892916
    backtrace (crc 40ba0c57):
      __kmalloc_cache_noprof+0x3c/0x69
      x25_route_ioctl+0xe8/0x1bf
      sock_ioctl+0x2d4/0x35d
      __x64_sys_ioctl+0x56a/0x77c

With the patch applied, kmemleak stays quiet. Good catch, I missed
the route reference in e21dba7a4df4.

Wentao, as the patch is marked "Changes Requested", please send a v2
as a new thread with [PATCH net v2] in the subject:

- describe in the commit message, in plain words, how you found the
  issue, e.g. "discovered by an AI code review agent", and add the
  kmemleak report above as validation: a single nonblocking connect()
  followed by deleting the route with SIOCDELRT is enough;
- drop the Assisted-by: line, checkpatch rejects it; if you want to
  say which tools helped with the patch itself, do so below the "---"
  line;
- add a link to this v1 below the "---" line.

Feel free to add my

Acked-by: Martin Schiller <ms@dev.tdt.de>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads