mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: HyunjungKo <hj351016@gmail.com>
To: Stanislav Yakovlev <stas.yakovlev@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-kernel@vger.kernel.org, HyunjungKo <hj351016@gmail.com>
Subject: [PATCH] wifi: ipw2200: cancel qos_activate work on device removal
Date: Thu,  5 Nov 2026 13:55:49 +0900	[thread overview]
Message-ID: <20261105045549.1287413-1-hj351016@gmail.com> (raw)

ipw_priv::qos_activate (handler ipw_bg_qos_activate) is scheduled on the
system workqueue from the QoS association/probe-response paths
(ipw_qos_association_resp(), ipw_handle_assoc_response()) via
schedule_work(&priv->qos_activate).

ipw_pci_remove() cancels ~two dozen other priv works with
cancel_work_sync()/cancel_delayed_work_sync() (associate, disassociate,
scan, rf_kill, roam, link_up/down, led_*, merge_networks, ...) but never
cancels qos_activate. The driver has no private workqueue, so the work
runs on the system workqueue and is not drained by any destroy_workqueue()
at teardown either.

If a qos_activate work is still pending when the device is removed,
ipw_pci_remove() goes on to free_irq(), free the libipw/netdev and
kfree(priv); the worker then dereferences the freed priv
(ipw_bg_qos_activate(): priv->mutex, priv->status, priv->assoc_network ->
ipw_qos_activate()) = use-after-free.

Cancel qos_activate alongside the other works in ipw_pci_remove(). The
handler takes priv->mutex and does not reschedule qos_activate, and this
cancel is not performed under priv->mutex, so cancel_work_sync() neither
deadlocks nor races a re-arm.

Found by code review; not reproduced. Trigger needs a QoS
association/probe-response frame racing device unbind. Same class as
commit (atm: fore200e) "fix use-after-free in tasklets during device
removal" and CVE-2024-27052 (wifi: rtl8xxxu): a teardown path that omits
cancelling an async callback racing the object free.

Signed-off-by: HyunjungKo <hj351016@gmail.com>
---
 drivers/net/wireless/intel/ipw2x00/ipw2200.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -11786,5 +11786,6 @@ static void ipw_pci_remove(struct pci_dev *pdev)
 	cancel_delayed_work_sync(&priv->led_link_off);
 	cancel_delayed_work_sync(&priv->led_act_off);
 	cancel_work_sync(&priv->merge_networks);
+	cancel_work_sync(&priv->qos_activate);

 	/* Free MAC hash list for ADHOC */
--
2.43.0

                 reply	other threads:[~2026-11-05  4:56 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=20261105045549.1287413-1-hj351016@gmail.com \
    --to=hj351016@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stas.yakovlev@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

all inboxes | Powered by JetHome®