Repository navigation
Conversation
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 <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
During system shutdown (
mwifiex_pcie_shutdown()->mwifiex_pcie_remove()->mwifiex_remove_card()),mwifiex_unregister_dev()setscard->adapter = NULLbeforemwifiex_free_adapter()->mwifiex_cleanup_pcie()callscancel_work_sync(&card->work).If
mwifiex_pcie_work()is running or scheduled during shutdown or removal (e.g. triggered by a command timeout or firmware dump on Marvell 88W8897 devices such as Surface Pro 6, Surface Book 1/2, or Surface 3 as also seen in linux-surface/linux-surface#1965),mwifiex_pcie_work()passescard->adapter(NULL) tomwifiex_pcie_device_dump_work()/mwifiex_pcie_card_reset_work(), resulting in a kernelNULLpointer dereference Oops during poweroff:Fix
cancel_work_sync(&card->work)(when!card->pci_reset_ongoing) inmwifiex_unregister_dev()after freeing IRQs and before clearingcard->adapter = NULL.if (!card->adapter) return;check inmwifiex_pcie_work().Made with Cursor