summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-08-25 08:56:44 -0600
committerJens Axboe <axboe@fb.com>2016-08-25 08:56:44 -0600
commit468c298ad3ed3f0d94a65f8ca00f6bfc6c2b4e33 (patch)
tree99528c78abdf52d5168cb0e02025427f4cc7804a /drivers
parent5bb53c0fb8e0fc2e34287d5d0fcadc784de913e1 (diff)
downloadlinux-468c298ad3ed3f0d94a65f8ca00f6bfc6c2b4e33.tar.bz2
Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"
This reverts commit ff06db1efb2ad6db06eb5b99b88a0c15a9cc9b0e.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/floppy.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index b71a9c767009..c557057fe8ae 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -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;