diff options
| author | Guangshuo Li <lgs201920130244@gmail.com> | 2026-04-15 18:45:37 +0300 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2026-05-05 17:57:02 +0300 |
| commit | 33e2b833c66b890a0d71c4fa82d4c97143f7f75f (patch) | |
| tree | 9316a43fdfd3294f678a0ceb057d2d31fb7d10d5 /include/linux/timerqueue.h | |
| parent | 9aa21e1549db8882ff77b691e7714153df21dff0 (diff) | |
| download | linux-33e2b833c66b890a0d71c4fa82d4c97143f7f75f.tar.xz | |
media: vimc: fix reference leak on failed device registration
When platform_device_register() fails in vimc_init(), the embedded
struct device in vimc_pdev has already been initialized by
device_initialize(), but the failure path returns the error without
dropping the device reference for the current platform device:
vimc_init()
-> platform_device_register(&vimc_pdev)
-> device_initialize(&vimc_pdev.dev)
-> setup_pdev_dma_masks(&vimc_pdev)
-> platform_device_add(&vimc_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: 4babf057c143f ("media: vimc: allocate vimc_device dynamically")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
