aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 5eadbb9d4d71..28002de783b6 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3714,6 +3714,12 @@ static int floppy_open(struct inode *inode, struct file *filp)
3714 USETF(FD_VERIFY); 3714 USETF(FD_VERIFY);
3715 } 3715 }
3716 3716
3717 /* set underlying gendisk policy to reflect real ro/rw status */
3718 if (UTESTF(FD_DISK_WRITABLE))
3719 inode->i_bdev->bd_disk->policy = 0;
3720 else
3721 inode->i_bdev->bd_disk->policy = 1;
3722
3717 if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) 3723 if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL)))
3718 goto out2; 3724 goto out2;
3719 3725
@@ -3770,8 +3776,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
3770 /* Allow ioctls if we have write-permissions even if read-only open. 3776 /* Allow ioctls if we have write-permissions even if read-only open.
3771 * Needed so that programs such as fdrawcmd still can work on write 3777 * Needed so that programs such as fdrawcmd still can work on write
3772 * protected disks */ 3778 * protected disks */
3773 if (filp->f_mode & 2 3779 if ((filp->f_mode & FMODE_WRITE) || !file_permission(filp, MAY_WRITE))
3774 || permission(filp->f_dentry->d_inode, 2, NULL) == 0)
3775 filp->private_data = (void *)8; 3780 filp->private_data = (void *)8;
3776 3781
3777 if (UFDCS->rawcmd == 1) 3782 if (UFDCS->rawcmd == 1)