Skip to content

floppy: fix reference leak on platform_device_register() failure#737

Open
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1080785=>linus-master
Open

floppy: fix reference leak on platform_device_register() failure#737
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1080785=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci bot commented Apr 13, 2026

Pull request for series with
subject: floppy: fix reference leak on platform_device_register() failure
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1080785

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 13, 2026

Upstream branch: 028ef9c
series: https://patchwork.kernel.org/project/linux-block/list/?series=1080785
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 14, 2026

Upstream branch: d60bc14
series: https://patchwork.kernel.org/project/linux-block/list/?series=1080785
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1080785=>linus-master branch from 86fdf86 to adccf02 Compare April 14, 2026 06:49
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci bot commented Apr 15, 2026

Upstream branch: d60bc14
series: https://patchwork.kernel.org/project/linux-block/list/?series=1081622
version: 2

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: 94fd0db ("[PATCH] Floppy: Add cmos attribute to floppy driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
@blktests-ci blktests-ci bot added V2 and removed V1 labels Apr 15, 2026
@blktests-ci blktests-ci bot force-pushed the series/1080785=>linus-master branch from adccf02 to 2749b75 Compare April 15, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant