]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"
authorJens Axboe <axboe@fb.com>
Thu, 25 Aug 2016 14:56:44 +0000 (08:56 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 25 Aug 2016 14:56:44 +0000 (08:56 -0600)
This reverts commit ff06db1efb2ad6db06eb5b99b88a0c15a9cc9b0e.

drivers/block/floppy.c

index b71a9c76700956e1ddfda4e742a2053b0f0769fe..c557057fe8ae05fd3ce2f93dc8f0c801083cb24f 100644 (file)
@@ -3663,6 +3663,11 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
 
        opened_bdev[drive] = bdev;
 
+       if (!(mode & (FMODE_READ|FMODE_WRITE))) {
+               res = -EINVAL;
+               goto out;
+       }
+
        res = -ENXIO;
 
        if (!floppy_track_buffer) {
@@ -3706,15 +3711,13 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
        if (UFDCS->rawcmd == 1)
                UFDCS->rawcmd = 2;
 
-       if (mode & (FMODE_READ|FMODE_WRITE)) {
-               UDRS->last_checked = 0;
-               clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
-               check_disk_change(bdev);
-               if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
-                       goto out;
-               if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
-                       goto out;
-       }
+       UDRS->last_checked = 0;
+       clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
+       check_disk_change(bdev);
+       if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
+               goto out;
+       if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
+               goto out;
 
        res = -EROFS;