diff options
| author | Guangshuo Li <lgs201920130244@gmail.com> | 2026-04-16 01:05:15 +0800 |
|---|---|---|
| committer | Helge Deller <deller@gmx.de> | 2026-04-17 15:46:46 +0200 |
| commit | 707610bcccbd0327530938e33f3f33211a640a4e (patch) | |
| tree | 2a315870e2a550f6445419c2f1a4271d78ff7dcf /rust/kernel | |
| parent | 1221365f55281349da4f4ba41c05b57cd15f5c28 (diff) | |
parisc: led: fix reference leak on failed device registration
When platform_device_register() fails in startup_leds(), the embedded
struct device in platform_leds has already been initialized by
device_initialize(), but the failure path only reports the error and
does not drop the device reference for the current platform device:
startup_leds()
-> platform_device_register(&platform_leds)
-> device_initialize(&platform_leds.dev)
-> setup_pdev_dma_masks(&platform_leds)
-> platform_device_add(&platform_leds)
This leads to a reference leak when platform_device_register() fails.
Fix this by calling platform_device_put() after reporting the error.
The issue was identified by a static analysis tool I developed and
confirmed by manual review.
Fixes: 789e527adfc33 ("parisc: led: Rewrite LED/LCD driver to utilizize Linux LED subsystem")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'rust/kernel')
0 files changed, 0 insertions, 0 deletions
