From 2fa8151a84d59d97c6d8f9717f27d5a28e56a559 Mon Sep 17 00:00:00 2001 From: Thijs Franssen <54217714+tfranssen@users.noreply.github.com> Date: Mon, 9 Nov 2026 16:26:01 +0100 Subject: [PATCH] mwifiex: pcie: cancel card work before clearing card->adapter In mwifiex_remove_card(), mwifiex_unregister_dev() sets card->adapter = NULL before mwifiex_free_adapter() -> mwifiex_cleanup_pcie() calls cancel_work_sync(&card->work). If mwifiex_pcie_work() is scheduled during shutdown or removal, it dereferences NULL card->adapter (at offset 0x88/0xa0), causing a kernel NULL pointer dereference Oops during system poweroff. Cancel card->work before setting card->adapter = NULL in mwifiex_unregister_dev(), and guard against a NULL card->adapter in mwifiex_pcie_work(). Patchset: mwifiex Signed-off-by: Thijs Franssen <54217714+tfranssen@users.noreply.github.com> Co-authored-by: Cursor --- drivers/net/wireless/marvell/mwifiex/pcie.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index b82158821404a..c19be081c8d2e 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -2849,6 +2849,9 @@ static void mwifiex_pcie_work(struct work_struct *work) struct pcie_service_card *card = container_of(work, struct pcie_service_card, work); + if (!card->adapter) + return; + if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags)) mwifiex_pcie_device_dump_work(card->adapter); @@ -3221,6 +3224,8 @@ static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) if (card->msi_enable) pci_disable_msi(pdev); } + if (!card->pci_reset_ongoing) + cancel_work_sync(&card->work); card->adapter = NULL; }