mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
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:
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| vimc-capture.c | ||
| vimc-common.c | ||
| vimc-common.h | ||
| vimc-core.c | ||
| vimc-debayer.c | ||
| vimc-lens.c | ||
| vimc-scaler.c | ||
| vimc-sensor.c | ||
| vimc-streamer.c | ||
| vimc-streamer.h | ||