* [PATCH] floppy: fail the open when floppy_revalidate() fails
@ 2026-10-06 10:02 Denis Efremov (Oracle)
0 siblings, 0 replies; only message in thread
From: Denis Efremov (Oracle) @ 2026-10-06 10:02 UTC (permalink / raw)
To: linux-block; +Cc: linux-kernel, Denis Efremov (Oracle)
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) <efremov@linux.com>
---
drivers/block/floppy.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index f04397b8e381..85eac9adc385 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -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
--
2.55.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-06 10:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 10:02 [PATCH] floppy: fail the open when floppy_revalidate() fails Denis Efremov (Oracle)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.