floppy: fix reference leak on platform_device_register() failure#737
floppy: fix reference leak on platform_device_register() failure#737blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
Conversation
|
Upstream branch: 028ef9c |
8f17195 to
6b4d829
Compare
|
Upstream branch: d60bc14 |
86fdf86 to
adccf02
Compare
|
Upstream branch: d60bc14 |
adccf02 to
2749b75
Compare
6b4d829 to
ceec5ed
Compare
|
Upstream branch: b4e0758 |
2749b75 to
49ab35a
Compare
ceec5ed to
3b54e52
Compare
|
Upstream branch: 6596a02 |
49ab35a to
ffd5465
Compare
3b54e52 to
6a0b974
Compare
|
Upstream branch: 507bd4b |
ffd5465 to
136b0ca
Compare
6a0b974 to
59ca59b
Compare
|
Upstream branch: dd6c438 |
136b0ca to
7464bb4
Compare
94f0438 to
857ada9
Compare
|
Upstream branch: dd6c438 |
7464bb4 to
d4c2ad1
Compare
857ada9 to
482ce5b
Compare
|
Upstream branch: dca922e |
d4c2ad1 to
cfc1509
Compare
482ce5b to
5a9f7c7
Compare
|
Upstream branch: e75a43c |
cfc1509 to
2fb4bdd
Compare
5a9f7c7 to
25a041f
Compare
|
Upstream branch: 66edb90 |
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: [email protected] Signed-off-by: Guangshuo Li <[email protected]>
2fb4bdd to
9a6efd6
Compare
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