mmc: via-sdmmc: cancel card-detect work on remove
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f0bf7f61b8405224bc52fc9a3ccd167a68126e00 · < f7ff3027ef004a331ef911a4886f12bc2e996037| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mmc: via-sdmmc: cancel card-detect work on remove
Disabling the device interrupt and freeing the IRQ prevents new card-detect work from being queued, but carddet_work already queued by the handler can still run after via_sd_remove() returns. via_sdc_card_detect() recovers the host through container_of() and dereferences its MMIO base; once remove() returns the host can be freed, so that work would touch freed memory.
Cancel carddet_work after freeing the IRQ and before cancelling finish_bh_work, which the card-detect handler can also queue. carddet_work can re-enable the interrupt through via_reset_pcictrl(); mask it again afterwards.
This issue was found by an in-house static analysis tool and confirmed by manual code review.
From the CVE record · Linux
The Linux kernel’s via-sdmmc driver can run queued card-detect work after device removal frees its host structure. This can cause a use-after-free when the work accesses the host’s MMIO base. The input does not identify an attacker route, authentication requirement, or user interaction.
Engineers running Linux systems that use the via-sdmmc driver should check their kernel; affected versions are not specified.