diff options
| author | Guangshuo Li <lgs201920130244@gmail.com> | 2026-04-15 19:26:27 +0300 |
|---|---|---|
| committer | Lee Jones <lee@kernel.org> | 2026-06-17 13:30:45 +0300 |
| commit | 8c2f0b42fc252e1bf1c7746447091a468e784ca1 (patch) | |
| tree | a5b13e1c52fb015142d1cb1067e4509a33ff64bb /include/linux/workqueue_api.h | |
| parent | 9adbe53e32cdf3785cf71e27962282c628e97f5c (diff) | |
| download | linux-8c2f0b42fc252e1bf1c7746447091a468e784ca1.tar.xz | |
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.
Fixes: b6d6454fdb66f ("[PATCH] mfd: SM501 core driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260415162627.3558789-1-lgs201920130244@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'include/linux/workqueue_api.h')
0 files changed, 0 insertions, 0 deletions
