diff options
| author | 2026-07-08 18:57:03 +0800 | |
|---|---|---|
| committer | 2026-10-05 18:59:41 +0400 | |
| commit | f1e72d80ad4ac5ff3573796d07bd1a1e74909f94 (patch) | |
| tree | 8513adc5beb5d0ab1c5938e746ba0daaa797dfe8 /scripts/Makefile.thinlto | |
| parent | floppy: avoid NULL deref in reset_interrupt when cont is cleared (diff) | |
floppy: unregister platform device on add_disk failure
The change referenced by the Fixes tag reverted a previous fix because
that fix added incorrect cleanup for the platform_device_register()
failure path.
However, reverting the whole change also removed the cleanup for a later
failure path. If platform_device_register() succeeds but device_add_disk()
fails, the current floppy platform device has already been registered and
registered[drive] has been set.
The common out_remove_drives path uses while (drive--), so it starts from
the previous drive and does not unregister the current one. As a result,
the platform device registered for the failing drive is leaked.
Unregister the current platform device directly on the device_add_disk()
failure path, where platform_device_register() is known to have
succeeded. Leave the platform_device_register() failure path unchanged.
Fixes: 895a9b37917d ("Revert "floppy: fix reference leak on platform_device_register() failure"")
Fixes: 47d34aa2d211 ("floppy: add error handling support for add_disk()")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260708105703.747262-1-lgs201920130244@gmail.com
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
