spi: fix use-after-free of the add_lock mutex
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
spi: fix use-after-free of the add_lock mutex
Commit 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on SPI buses") introduced a per-controller mutex. But mutex_unlock() of said lock is called after the controller is already freed:
spi_unregister_controller(ctlr) -> put_device(&ctlr->dev) -> spi_controller_release(dev) -> mutex_unlock(&ctrl->add_lock)
Move the put_device() after the mutex_unlock().
From the CVE record · Linux
The Linux kernel SPI subsystem can unlock a controller mutex after the controller has been freed, causing a use-after-free. The input does not specify how an attacker could trigger it, whether authentication or user interaction is needed, or what impact exploitation could have.
Engineers running the Linux kernel should check their SPI subsystem; affected versions are not specified.