From: Ren Wei <n05ec@lzu.edu.cn>
To: linux-hams@vger.kernel.org, netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, kees@kernel.org,
takamitz@amazon.co.jp, kuniyu@google.com,
jiayuan.chen@shopee.com, mingo@kernel.org, stanksal@purdue.edu,
jlayton@kernel.org, yifanwucs@gmail.com, tomapufckgml@gmail.com,
bird@lzu.edu.cn, yuantan098@gmail.com, tonanli66@gmail.com,
n05ec@lzu.edu.cn
Subject: [PATCH net 1/1] net/rose: hold listener socket during call request handling
Date: Fri, 17 Apr 2026 19:01:51 +0800 [thread overview]
Message-ID: <52776256bf0fc38de92fe3edf39434538b672b69.1776327338.git.tonanli66@gmail.com> (raw)
In-Reply-To: <cover.1776327338.git.tonanli66@gmail.com>
From: Nan Li <tonanli66@gmail.com>
The call request receive path keeps using the listener socket after the
lookup lock has been dropped. Keep the listener alive across the
remaining validation and child socket setup by taking a reference in the
lookup path and releasing it once request handling is finished.
This makes listener lifetime handling explicit and avoids races with
concurrent socket teardown.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@kernel.org
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Co-developed-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Nan Li <tonanli66@gmail.com>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
---
net/rose/af_rose.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index d5032840ee48..c96325e54a86 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -277,8 +277,10 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, call) &&
- !rose->source_ndigis && s->sk_state == TCP_LISTEN)
+ !rose->source_ndigis && s->sk_state == TCP_LISTEN) {
+ sock_hold(s);
goto found;
+ }
}
sk_for_each(s, &rose_list) {
@@ -286,8 +288,10 @@ static struct sock *rose_find_listener(rose_address *addr, ax25_address *call)
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, &null_ax25_address) &&
- s->sk_state == TCP_LISTEN)
+ s->sk_state == TCP_LISTEN) {
+ sock_hold(s);
goto found;
+ }
}
s = NULL;
found:
@@ -1056,10 +1060,13 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
/*
* We can't accept the Call Request.
*/
- if (sk == NULL || sk_acceptq_is_full(sk) ||
+ if (sk == NULL)
+ goto out_clear_request;
+
+ if (sk_acceptq_is_full(sk) ||
(make = rose_make_new(sk)) == NULL) {
- rose_transmit_clear_request(neigh, lci, ROSE_NETWORK_CONGESTION, 120);
- return 0;
+ sock_put(sk);
+ goto out_clear_request;
}
skb->sk = make;
@@ -1110,7 +1117,14 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_data_ready(sk);
+ sock_put(sk);
+
return 1;
+
+out_clear_request:
+ rose_transmit_clear_request(neigh, lci, ROSE_NETWORK_CONGESTION, 120);
+
+ return 0;
}
static int rose_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
--
2.43.0
next parent reply other threads:[~2026-04-17 11:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1776327338.git.tonanli66@gmail.com>
2026-04-17 11:01 ` Ren Wei [this message]
2026-04-20 16:26 ` [PATCH net 1/1] net/rose: hold listener socket during call request handling Simon Horman
2026-04-20 19:11 ` Yuan Tan
2026-04-21 11:23 ` Paolo Abeni
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=52776256bf0fc38de92fe3edf39434538b672b69.1776327338.git.tonanli66@gmail.com \
--to=n05ec@lzu.edu.cn \
--cc=bird@lzu.edu.cn \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiayuan.chen@shopee.com \
--cc=jlayton@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-hams@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stanksal@purdue.edu \
--cc=takamitz@amazon.co.jp \
--cc=tomapufckgml@gmail.com \
--cc=tonanli66@gmail.com \
--cc=yifanwucs@gmail.com \
--cc=yuantan098@gmail.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