Netdev List
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: Martin Schiller <ms@dev.tdt.de>,
	"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>
Cc: linux-x25@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH] net/x25: release the route on a nonblocking connect
Date: Wed,  4 Nov 2026 02:28:12 +0000	[thread overview]
Message-ID: <20261104022812.1484250-1-vulab@iscas.ac.cn> (raw)

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


             reply	other threads:[~2026-11-04  2:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  2:28 Wentao Liang [this message]
2026-11-04  2:32 ` [PATCH] net/x25: release the route on a nonblocking connect netdev-bot+sinfo
2026-11-23 17:44   ` Martin Schiller

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=20261104022812.1484250-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-x25@vger.kernel.org \
    --cc=ms@dev.tdt.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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