From: Greg Kroah-Hartman Date: Wed, 1 Sep 2021 09:50:46 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.4.283~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=688b3522e29af9b98781bb5a548fb7acfce00a79;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: revert-floppy-reintroduce-o_ndelay-fix.patch --- diff --git a/queue-5.10/revert-floppy-reintroduce-o_ndelay-fix.patch b/queue-5.10/revert-floppy-reintroduce-o_ndelay-fix.patch new file mode 100644 index 00000000000..8883f8bb94b --- /dev/null +++ b/queue-5.10/revert-floppy-reintroduce-o_ndelay-fix.patch @@ -0,0 +1,72 @@ +From c7e9d0020361f4308a70cdfd6d5335e273eb8717 Mon Sep 17 00:00:00 2001 +From: Denis Efremov +Date: Sat, 7 Aug 2021 10:37:02 +0300 +Subject: Revert "floppy: reintroduce O_NDELAY fix" + +From: Denis Efremov + +commit c7e9d0020361f4308a70cdfd6d5335e273eb8717 upstream. + +The patch breaks userspace implementations (e.g. fdutils) and introduces +regressions in behaviour. Previously, it was possible to O_NDELAY open a +floppy device with no media inserted or with write protected media without +an error. Some userspace tools use this particular behavior for probing. + +It's not the first time when we revert this patch. Previous revert is in +commit f2791e7eadf4 (Revert "floppy: refactor open() flags handling"). + +This reverts commit 8a0c014cd20516ade9654fc13b51345ec58e7be8. + +Link: https://lore.kernel.org/linux-block/de10cb47-34d1-5a88-7751-225ca380f735@compro.net/ +Reported-by: Mark Hounschell +Cc: Jiri Kosina +Cc: Wim Osterholt +Cc: Kurt Garloff +Cc: +Signed-off-by: Denis Efremov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/floppy.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +--- a/drivers/block/floppy.c ++++ b/drivers/block/floppy.c +@@ -4120,23 +4120,23 @@ static int floppy_open(struct block_devi + if (fdc_state[FDC(drive)].rawcmd == 1) + fdc_state[FDC(drive)].rawcmd = 2; + +- if (mode & (FMODE_READ|FMODE_WRITE)) { +- drive_state[drive].last_checked = 0; +- clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &drive_state[drive].flags); +- if (bdev_check_media_change(bdev)) +- floppy_revalidate(bdev->bd_disk); +- 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)) ++ if (!(mode & FMODE_NDELAY)) { ++ if (mode & (FMODE_READ|FMODE_WRITE)) { ++ drive_state[drive].last_checked = 0; ++ clear_bit(FD_OPEN_SHOULD_FAIL_BIT, ++ &drive_state[drive].flags); ++ if (bdev_check_media_change(bdev)) ++ floppy_revalidate(bdev->bd_disk); ++ 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)) ++ goto out; ++ } ++ res = -EROFS; ++ if ((mode & FMODE_WRITE) && ++ !test_bit(FD_DISK_WRITABLE_BIT, &drive_state[drive].flags)) + goto out; + } +- +- res = -EROFS; +- +- if ((mode & FMODE_WRITE) && +- !test_bit(FD_DISK_WRITABLE_BIT, &drive_state[drive].flags)) +- goto out; +- + mutex_unlock(&open_lock); + mutex_unlock(&floppy_mutex); + return 0; diff --git a/queue-5.10/series b/queue-5.10/series index 46ae0e15ed0..c2863f5b046 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -97,3 +97,4 @@ lkdtm-enable-double_fault-on-all-architectures.patch arm64-dts-qcom-msm8994-angler-fix-gpio-reserved-ranges-85-88.patch btrfs-fix-null-pointer-dereference-when-deleting-device-by-invalid-id.patch kthread-fix-pf_kthread-vs-to_kthread-race.patch +revert-floppy-reintroduce-o_ndelay-fix.patch