public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfc: hci: shdlc: Stop timers and work before freeing context
@ 2026-02-03 11:31 Votokina Victoria
  2026-02-06  3:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Votokina Victoria @ 2026-02-03 11:31 UTC (permalink / raw)
  To: David S . Miller
  Cc: Votokina Victoria, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Thomas Gleixner, Ingo Molnar, Eric Lapuyade,
	Samuel Ortiz, netdev, linux-kernel, lvc-project

llc_shdlc_deinit() purges SHDLC skb queues and frees the llc_shdlc
structure while its timers and state machine work may still be active.

Timer callbacks can schedule sm_work, and sm_work accesses SHDLC state
and the skb queues. If teardown happens in parallel with a queued/running
work item, it can lead to UAF and other shutdown races.

Stop all SHDLC timers and cancel sm_work synchronously before purging the
queues and freeing the context.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 4a61cd6687fc ("NFC: Add an shdlc llc module to llc core")
Signed-off-by: Votokina Victoria <Victoria.Votokina@kaspersky.com>
---
 net/nfc/hci/llc_shdlc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c
index 4fc37894860c..08c8aa1530d8 100644
--- a/net/nfc/hci/llc_shdlc.c
+++ b/net/nfc/hci/llc_shdlc.c
@@ -762,6 +762,14 @@ static void llc_shdlc_deinit(struct nfc_llc *llc)
 {
 	struct llc_shdlc *shdlc = nfc_llc_get_data(llc);
 
+	timer_shutdown_sync(&shdlc->connect_timer);
+	timer_shutdown_sync(&shdlc->t1_timer);
+	timer_shutdown_sync(&shdlc->t2_timer);
+	shdlc->t1_active = false;
+	shdlc->t2_active = false;
+
+	cancel_work_sync(&shdlc->sm_work);
+
 	skb_queue_purge(&shdlc->rcv_q);
 	skb_queue_purge(&shdlc->send_q);
 	skb_queue_purge(&shdlc->ack_pending_q);
-- 
2.43.0


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

* Re: [PATCH] nfc: hci: shdlc: Stop timers and work before freeing context
  2026-02-03 11:31 [PATCH] nfc: hci: shdlc: Stop timers and work before freeing context Votokina Victoria
@ 2026-02-06  3:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-06  3:00 UTC (permalink / raw)
  To: Votokina Victoria
  Cc: davem, edumazet, kuba, pabeni, horms, tglx, mingo, eric.lapuyade,
	sameo, netdev, linux-kernel, lvc-project

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 3 Feb 2026 14:31:57 +0300 you wrote:
> llc_shdlc_deinit() purges SHDLC skb queues and frees the llc_shdlc
> structure while its timers and state machine work may still be active.
> 
> Timer callbacks can schedule sm_work, and sm_work accesses SHDLC state
> and the skb queues. If teardown happens in parallel with a queued/running
> work item, it can lead to UAF and other shutdown races.
> 
> [...]

Here is the summary with links:
  - nfc: hci: shdlc: Stop timers and work before freeing context
    https://git.kernel.org/netdev/net/c/c9efde1e537b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-02-06  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 11:31 [PATCH] nfc: hci: shdlc: Stop timers and work before freeing context Votokina Victoria
2026-02-06  3:00 ` patchwork-bot+netdevbpf

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