From: Tristan Madani <tristmd@gmail.com>
To: David Heidelberg <david@ixit.cz>
Cc: Zheng Wang <zyytlz.wz@163.com>,
oe-linux-nfc@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH] nfc: st-nci: use timer_shutdown_sync in ndlc_remove
Date: Wed, 11 Nov 2026 14:07:46 +0000 [thread overview]
Message-ID: <20261111140746.375923-1-tristmd@gmail.com> (raw)
From: Tristan Madani <tristan@talencesecurity.com>
ndlc_remove() uses timer_delete_sync() to stop t1_timer and t2_timer
before cancel_work_sync(). However, the timer callbacks
ndlc_t1_timeout() and ndlc_t2_timeout() schedule sm_work, and
llt_ndlc_sm_work() re-arms the timers via mod_timer(). This creates a
circular rearm: after timer_delete_sync() returns, sm_work can still
re-arm the timer, which fires again after cancel_work_sync() completes.
Use timer_shutdown_sync() instead, which prevents the timers from being
re-armed by mod_timer() calls in the work function, breaking the
circular dependency.
Fixes: 5000fe6c27827 ("nfc: st-nci: Fix use after free bug in ndlc_remove due to race condition")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/nfc/st-nci/ndlc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/st-nci/ndlc.c b/drivers/nfc/st-nci/ndlc.c
index be4808859cfa9..14e1213d76c9b 100644
--- a/drivers/nfc/st-nci/ndlc.c
+++ b/drivers/nfc/st-nci/ndlc.c
@@ -283,8 +283,8 @@ EXPORT_SYMBOL(ndlc_probe);
void ndlc_remove(struct llt_ndlc *ndlc)
{
/* cancel timers */
- timer_delete_sync(&ndlc->t1_timer);
- timer_delete_sync(&ndlc->t2_timer);
+ timer_shutdown_sync(&ndlc->t1_timer);
+ timer_shutdown_sync(&ndlc->t2_timer);
ndlc->t2_active = false;
ndlc->t1_active = false;
/* cancel work */
--
2.47.3
reply other threads:[~2026-11-11 14:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261111140746.375923-1-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=david@ixit.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-linux-nfc@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=tristan@talencesecurity.com \
--cc=zyytlz.wz@163.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
all inboxes | Powered by JetHome®