aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/bsg.c2
-rw-r--r--block/scsi_ioctl.c10
-rw-r--r--drivers/block/cciss.c3
-rw-r--r--drivers/block/ub.c2
-rw-r--r--drivers/block/virtio_blk.c4
-rw-r--r--drivers/cdrom/cdrom.c2
-rw-r--r--drivers/ide/ide-floppy_ioctl.c4
-rw-r--r--drivers/scsi/sd.c3
-rw-r--r--drivers/scsi/st.c4
-rw-r--r--include/linux/blkdev.h4
10 files changed, 20 insertions, 18 deletions
diff --git a/block/bsg.c b/block/bsg.c
index 2d36b127f384..e8bd2475682a 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -914,7 +914,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
914 case SG_EMULATED_HOST: 914 case SG_EMULATED_HOST:
915 case SCSI_IOCTL_SEND_COMMAND: { 915 case SCSI_IOCTL_SEND_COMMAND: {
916 void __user *uarg = (void __user *) arg; 916 void __user *uarg = (void __user *) arg;
917 return scsi_cmd_ioctl(file, bd->queue, NULL, cmd, uarg); 917 return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg);
918 } 918 }
919 case SG_IO: { 919 case SG_IO: {
920 struct request *rq; 920 struct request *rq;
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 375e25df8adc..5963cf91a3a0 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -517,8 +517,8 @@ static inline int blk_send_start_stop(struct request_queue *q,
517 return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data); 517 return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data);
518} 518}
519 519
520int scsi_cmd_ioctl(struct file *file, struct request_queue *q, 520int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mode,
521 struct gendisk *bd_disk, unsigned int cmd, void __user *arg) 521 unsigned int cmd, void __user *arg)
522{ 522{
523 int err; 523 int err;
524 524
@@ -559,7 +559,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
559 err = -EFAULT; 559 err = -EFAULT;
560 if (copy_from_user(&hdr, arg, sizeof(hdr))) 560 if (copy_from_user(&hdr, arg, sizeof(hdr)))
561 break; 561 break;
562 err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0); 562 err = sg_io(q, bd_disk, &hdr, mode);
563 if (err == -EFAULT) 563 if (err == -EFAULT)
564 break; 564 break;
565 565
@@ -607,7 +607,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
607 hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd; 607 hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
608 hdr.cmd_len = sizeof(cgc.cmd); 608 hdr.cmd_len = sizeof(cgc.cmd);
609 609
610 err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0); 610 err = sg_io(q, bd_disk, &hdr, mode);
611 if (err == -EFAULT) 611 if (err == -EFAULT)
612 break; 612 break;
613 613
@@ -631,7 +631,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
631 if (!arg) 631 if (!arg)
632 break; 632 break;
633 633
634 err = sg_scsi_ioctl(q, bd_disk, file ? file->f_mode : 0, arg); 634 err = sg_scsi_ioctl(q, bd_disk, mode, arg);
635 break; 635 break;
636 case CDROMCLOSETRAY: 636 case CDROMCLOSETRAY:
637 err = blk_send_start_stop(q, bd_disk, 0x03); 637 err = blk_send_start_stop(q, bd_disk, 0x03);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1e1f9153000c..d9b1c15b8113 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1232,7 +1232,8 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
1232 case SG_EMULATED_HOST: 1232 case SG_EMULATED_HOST:
1233 case SG_IO: 1233 case SG_IO:
1234 case SCSI_IOCTL_SEND_COMMAND: 1234 case SCSI_IOCTL_SEND_COMMAND:
1235 return scsi_cmd_ioctl(filep, disk->queue, disk, cmd, argp); 1235 return scsi_cmd_ioctl(disk->queue, disk,
1236 filep ? filep->f_mode : 0, cmd, argp);
1236 1237
1237 /* scsi_cmd_ioctl would normally handle these, below, but */ 1238 /* scsi_cmd_ioctl would normally handle these, below, but */
1238 /* they aren't a good fit for cciss, as CD-ROMs are */ 1239 /* they aren't a good fit for cciss, as CD-ROMs are */
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 85d41eb67c0b..bc04330f3683 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1729,7 +1729,7 @@ static int ub_bd_ioctl(struct inode *inode, struct file *filp,
1729 struct gendisk *disk = inode->i_bdev->bd_disk; 1729 struct gendisk *disk = inode->i_bdev->bd_disk;
1730 void __user *usermem = (void __user *) arg; 1730 void __user *usermem = (void __user *) arg;
1731 1731
1732 return scsi_cmd_ioctl(filp, disk->queue, disk, cmd, usermem); 1732 return scsi_cmd_ioctl(disk->queue, disk, filp ? filp->f_mode : 0, cmd, usermem);
1733} 1733}
1734 1734
1735/* 1735/*
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6ec5fc052786..7643cd16fd67 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -149,8 +149,8 @@ static void do_virtblk_request(struct request_queue *q)
149static int virtblk_ioctl(struct inode *inode, struct file *filp, 149static int virtblk_ioctl(struct inode *inode, struct file *filp,
150 unsigned cmd, unsigned long data) 150 unsigned cmd, unsigned long data)
151{ 151{
152 return scsi_cmd_ioctl(filp, inode->i_bdev->bd_disk->queue, 152 return scsi_cmd_ioctl(inode->i_bdev->bd_disk->queue,
153 inode->i_bdev->bd_disk, cmd, 153 inode->i_bdev->bd_disk, filp->f_mode, cmd,
154 (void __user *)data); 154 (void __user *)data);
155} 155}
156 156
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 4feefa622aed..e286eb5d1f6a 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2672,7 +2672,7 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
2672 /* 2672 /*
2673 * Try the generic SCSI command ioctl's first. 2673 * Try the generic SCSI command ioctl's first.
2674 */ 2674 */
2675 ret = scsi_cmd_ioctl(file, disk->queue, disk, cmd, argp); 2675 ret = scsi_cmd_ioctl(disk->queue, disk, file ? file->f_mode : 0, cmd, argp);
2676 if (ret != -ENOTTY) 2676 if (ret != -ENOTTY)
2677 return ret; 2677 return ret;
2678 2678
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index 0d5f5054ab64..3c9da4ac9341 100644
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -280,8 +280,8 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode,
280 * and CDROM_SEND_PACKET (legacy) ioctls 280 * and CDROM_SEND_PACKET (legacy) ioctls
281 */ 281 */
282 if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) 282 if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
283 err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, 283 err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
284 bdev->bd_disk, cmd, argp); 284 file ? file->f_mode : 0, cmd, argp);
285 285
286 if (err == -ENOTTY) 286 if (err == -ENOTTY)
287 err = generic_ide_ioctl(drive, file, bdev, cmd, arg); 287 err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 202c1ed9abd7..5d74413f591a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -775,7 +775,8 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
775 case SCSI_IOCTL_GET_BUS_NUMBER: 775 case SCSI_IOCTL_GET_BUS_NUMBER:
776 return scsi_ioctl(sdp, cmd, p); 776 return scsi_ioctl(sdp, cmd, p);
777 default: 777 default:
778 error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p); 778 error = scsi_cmd_ioctl(disk->queue, disk,
779 filp ? filp->f_mode : 0, cmd, p);
779 if (error != -ENOTTY) 780 if (error != -ENOTTY)
780 return error; 781 return error;
781 } 782 }
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 5c28d08f18f4..8dffac9f3419 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3567,8 +3567,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
3567 !capable(CAP_SYS_RAWIO)) 3567 !capable(CAP_SYS_RAWIO))
3568 i = -EPERM; 3568 i = -EPERM;
3569 else 3569 else
3570 i = scsi_cmd_ioctl(file, STp->disk->queue, 3570 i = scsi_cmd_ioctl(STp->disk->queue, STp->disk,
3571 STp->disk, cmd_in, p); 3571 file->f_mode, cmd_in, p);
3572 if (i != -ENOTTY) 3572 if (i != -ENOTTY)
3573 return i; 3573 return i;
3574 break; 3574 break;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8945c30e9936..48f41b991adb 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -717,8 +717,8 @@ extern void blk_plug_device(struct request_queue *);
717extern void blk_plug_device_unlocked(struct request_queue *); 717extern void blk_plug_device_unlocked(struct request_queue *);
718extern int blk_remove_plug(struct request_queue *); 718extern int blk_remove_plug(struct request_queue *);
719extern void blk_recount_segments(struct request_queue *, struct bio *); 719extern void blk_recount_segments(struct request_queue *, struct bio *);
720extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 720extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
721 struct gendisk *, unsigned int, void __user *); 721 unsigned int, void __user *);
722extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, 722extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
723 struct scsi_ioctl_command __user *); 723 struct scsi_ioctl_command __user *);
724 724