floppy: fail the open when floppy_revalidate() fails
Subsystems (2)
Denis Efremov (Oracle)
maintainerPATCH 1/1 floppy: fail the open when floppy_revalidate() fails
floppy_open() ignores what floppy_revalidate() returns. If lock_fdc() is interrupted, or __floppy_read_block_0() can't allocate its page, the open can succeed without the disk check.
Commit a0c80efe5956 ("floppy: fix lock_fdc() signal handling") made floppy_revalidate() return -EINTR instead of going on without the FDC lock, but the error was dropped. Return the error instead.
Fixes 4a6f3d480edc ("floppy: use bdev_check_media_change")
Signed-off-by Denis Efremov (Oracle) <[email protected]>
--- drivers/block/floppy.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/block/floppy.c +6 -2
@@ -4052,8 +4052,12 @@ static int floppy_open(struct gendisk *disk, blk_mode_t mode) drive_state[drive].last_checked =0 ;clear_bit (FD_OPEN_SHOULD_FAIL_BIT , &drive_state[drive].flags); -if (disk_check_media_change (disk)) -floppy_revalidate (disk); +if (disk_check_media_change (disk)) { + res =floppy_revalidate (disk); +if (res) + goto out; + } + res = -ENXIO ;if (test_bit (FD_DISK_CHANGED_BIT , &drive_state[drive].flags)) goto out;if (test_bit (FD_OPEN_SHOULD_FAIL_BIT , &drive_state[drive].flags))
base-commit: 2c3418fffa9d037b2038a6db48be63f9e2291806
Signature · 1 line
2.55.0