summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorGuangshuo Li <lgs201920130244@gmail.com>2026-04-15 22:57:08 +0800
committerJens Axboe <axboe@kernel.dk>2026-04-17 14:36:40 -0600
commite784f2ea0b4fd0e7b70028ff8218f22456c5dcf8 (patch)
tree8dbe31c1c0f074e3056b25e5f654afcfdd621fa2 /include/linux
parenta7c9fa7f6601c84d27cdd43bd96e8fcbacfb7479 (diff)
floppy: fix reference leak on platform_device_register() failure
When platform_device_register() fails in do_floppy_init(), the embedded struct device in floppy_device[drive] has already been initialized by device_initialize(), but the failure path jumps to out_remove_drives without dropping the device reference for the current drive. Previously registered floppy devices are cleaned up in out_remove_drives, but the device for the drive that fails registration is not, leading to a reference leak. The issue was identified by a static analysis tool I developed and confirmed by manual review. Fix this by calling put_device() for the current floppy device before jumping to the common cleanup path. Fixes: 94fd0db7bfb4a ("[PATCH] Floppy: Add cmos attribute to floppy driver") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Link: https://patch.msgid.link/20260415145708.3331818-1-lgs201920130244@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions