mfd: sm501: Fix reference leak on failed device registration
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b6d6454fdb66f3829af8b92ab06825b6060fdf7e · < 16a42c88c4667fa0bd944e438a667e059551f1f1| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mfd: sm501: Fix reference leak on failed device registration
When platform_device_register() fails in sm501_register_device(), the embedded struct device in pdev has already been initialized by device_initialize(), but the failure path only reports the error and returns without dropping the device reference for the current platform device:
sm501_register_device() -> platform_device_register(pdev) -> device_initialize(&pdev->dev) -> setup_pdev_dma_masks(pdev) -> platform_device_add(pdev)
This leads to a reference leak when platform_device_register() fails. Fix this by calling platform_device_put() before returning the error.
The issue was identified by a static analysis tool I developed and confirmed by manual review.
From the CVE record · Linux
The Linux kernel's sm501 device-registration path leaks a device reference if platform_device_register() fails. The input does not describe an attacker action or specify network access, authentication, or user interaction requirements.
Engineers running Linux kernels with the sm501 driver should check their vendor's affected-version information; no versions are specified here.