Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Jeff Johnson" <jeff.johnson@oss.qualcomm.com>
Cc: linux-wireless@vger.kernel.org,
	syzbot+e91dc13b1b37759b3d9f@syzkaller.appspotmail.com
Subject: [PATCH] wifi: ath9k: make sure we stop the wmi tasklet on init fail
Date: Wed, 21 Oct 2026 14:02:36 +0200	[thread overview]
Message-ID: <20261021120237.481898-1-toke@toke.dk> (raw)

The ath9k_wmi_event_tasklet() reschedules itself until device
initialisation is complete, but if the initialisation fails it is never
interrupted. Syzbot triggered a use-after-free in tasklet_action_common
because of this.

Add a guard to the reschedule logic so it aborts if wmi->stopped is set,
and add a call to ath9k_wmi_event_drain() in ath9k_stop_wmi(), so we are
sure that the queue is drained and the tasklet is stopped on teardown.

Fixes: 1af8dc9ca726 ("wifi: ath9k: Clean up device initialisation guards")
Reported-by: syzbot+e91dc13b1b37759b3d9f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e91dc13b1b37759b3d9f
Tested-by: syzbot+e91dc13b1b37759b3d9f@syzkaller.appspotmail.com
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
 drivers/net/wireless/ath/ath9k/wmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index 4a08babb6d9d..c60c8b63623d 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -118,6 +118,8 @@ void ath9k_stop_wmi(struct ath9k_htc_priv *priv)
 	mutex_lock(&wmi->op_mutex);
 	wmi->stopped = true;
 	mutex_unlock(&wmi->op_mutex);
+
+	ath9k_wmi_event_drain(priv);
 }
 
 void ath9k_destroy_wmi(struct ath9k_htc_priv *priv)
@@ -148,7 +150,8 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t)
 
 	/* Check if ath9k_init_device() completed. */
 	if (!smp_load_acquire(&priv->initialized)) {
-		tasklet_schedule(t);
+		if (!READ_ONCE(wmi->stopped))
+			tasklet_schedule(t);
 		return;
 	}
 
-- 
2.56.0


             reply	other threads:[~2026-10-21 12:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 12:02 Toke Høiland-Jørgensen [this message]
2026-10-26  1:56 ` [PATCH] wifi: ath9k: make sure we stop the wmi tasklet on init fail Eduard Zateev
2026-10-26  9:16   ` Toke Høiland-Jørgensen

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=20261021120237.481898-1-toke@toke.dk \
    --to=toke@toke.dk \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=syzbot+e91dc13b1b37759b3d9f@syzkaller.appspotmail.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