CVE-2026-143177: memstick: core: don't clear dev->driver in memstick_device_remove()
In the Linux kernel, the following vulnerability has been resolved:
memstick: core: don't clear dev->driver in memstickdeviceremove()
memstickdeviceremove() sets card->dev.driver to NULL after calling the driver's remove() callback. Since commit a995fe1a3aa7 ("rust: driver: drop device private data post unbind"), deviceunbindcleanup() dereferences dev->driver after the bus remove() callback has returned, so this should result in a NULL pointer dereference whenever a MemoryStick card is removed or its driver is unbound.
The driver core clears dev->driver itself in deviceunbindcleanup(), so there is no need for the bus code to do it. Remove the assignment.
This was found by code inspection, with the help of an AI coding assistant, after hitting the same bug in the TI FlashMedia bus code (drivers/misc/tifmcore.c), which oopsed on SD card removal. It has only been compile-tested: no MemoryStick hardware was available.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In memstick core, remove the assignment that sets card->dev.driver to NULL in memstick_device_remove(); the driver core clears dev->driver during device_unbind_cleanup().
Event History
Frequently Asked Questions
When can this issue be triggered?
It should occur when a MemoryStick card is removed or when its driver is unbound. The affected path can dereference a NULL dev->driver pointer after the bus driver's remove callback returns.
What systems are realistically exposed?
Systems using the Linux kernel's MemoryStick subsystem are relevant, particularly where MemoryStick cards can be removed or their drivers can be unbound. The report notes that the issue was only compile-tested because no MemoryStick hardware was available.
Is this a remotely exploitable issue?
The available information describes a kernel NULL pointer dereference during device removal or driver unbinding. It does not provide evidence of remote exploitation or identify any required attacker access.
What change resolves the problem?
The fix removes the assignment that clears card->dev.driver in memstick_device_remove(). The driver core already clears dev->driver during device_unbind_cleanup(), after it has finished using the pointer.