Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH net] tcp: cancel cloned request timers without waiting
@ 2026-11-19  2:56 Wentao Guan
  2026-11-19  3:03 ` netdev-bot+sinfo
  2026-11-19  6:22 ` Kuniyuki Iwashima
  0 siblings, 2 replies; 4+ messages in thread
From: Wentao Guan @ 2026-11-19  2:56 UTC (permalink / raw)
  To: edumazet, ncardwell, kuba, kuniyu; +Cc: netdev, melotti, Wentao Guan, stable

When a cloned request is migrated again, its timer has the same lockdep
class as the running request callback. Using timer_delete_sync() through
__inet_csk_reqsk_queue_drop(..., false) can therefore trigger a
recursive-locking splat and disable lockdep.

The clone is unhashed when inet_ehash_insert() fails, so
reqsk_queue_unlink() is a no-op. Its timer is pinned to the current CPU,
allowing it to be cancelled without waiting for its callback. Use
timer_delete() and drop the timer reference directly instead of
synchronously deleting it through the queue helper.

Fixes: 97c8a3c1f73d ("tcp: Fix potential UAF in reqsk_timer_handler().")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
 net/ipv4/inet_connection_sock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 6c079929e06f6..346d0015a140d 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1121,8 +1121,8 @@ static void reqsk_timer_handler(struct timer_list *t)
 			return;
 
 		if (!inet_ehash_insert(req_to_sk(nreq), req_to_sk(oreq), NULL)) {
-			/* delete timer */
-			__inet_csk_reqsk_queue_drop(sk_listener, nreq, false);
+			if (timer_delete(&nreq->rsk_timer))
+				reqsk_put(nreq);
 			goto no_ownership;
 		}
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-19  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  2:56 [PATCH net] tcp: cancel cloned request timers without waiting Wentao Guan
2026-11-19  3:03 ` netdev-bot+sinfo
2026-11-19  6:22 ` Kuniyuki Iwashima
2026-11-19  6:40   ` 关文涛

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox