diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-01-12 16:01:27 +0100 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2012-02-11 15:40:54 +0100 |
commit | 7d064959836f6ab504b80a6ad858ed14aa0bb7a0 (patch) | |
tree | d7413b3891ec4c786ff1a2de21a31bcdbbe7c8b7 /drivers | |
parent | d172827c67001f409b59264cf2dd87e090681d7d (diff) |
block: add and use scsi_blk_cmd_ioctl
commit 577ebb374c78314ac4617242f509e2f5e7156649 upstream.
Introduce a wrapper around scsi_cmd_ioctl that takes a block device.
The function will then be enhanced to detect partition block devices
and, in that case, subject the ioctls to whitelisting.
Cc: linux-scsi@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Cc: James Bottomley <JBottomley@parallels.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[bwh: Backport to 2.6.32 - adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[wt: slightly changed the interface to match 2.6.27's scsi_cmd_ioctl()
which still needs the file pointer but has no mode parameter].
Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/cciss.c | 6 | ||||
-rw-r--r-- | drivers/block/ub.c | 3 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 3 | ||||
-rw-r--r-- | drivers/cdrom/cdrom.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 3 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 2 |
6 files changed, 8 insertions, 12 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index ee1eb5e831b..efe615f3169 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1225,7 +1225,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, return status; } - /* scsi_cmd_ioctl handles these, below, though some are not */ + /* scsi_cmd_blk_ioctl handles these, below, though some are not */ /* very meaningful for cciss. SG_IO is the main one people want. */ case SG_GET_VERSION_NUM: @@ -1236,9 +1236,9 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, case SG_EMULATED_HOST: case SG_IO: case SCSI_IOCTL_SEND_COMMAND: - return scsi_cmd_ioctl(filep, disk->queue, disk, cmd, argp); + return scsi_cmd_blk_ioctl(filep, bdev, cmd, argp); - /* scsi_cmd_ioctl would normally handle these, below, but */ + /* scsi_cmd_blk_ioctl would normally handle these, below, but */ /* they aren't a good fit for cciss, as CD-ROMs are */ /* not supported, and we don't have any bus/target/lun */ /* which we present to the kernel. */ diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 3a281ef11ff..a05a76feb98 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c @@ -1729,10 +1729,9 @@ static int ub_bd_release(struct inode *inode, struct file *filp) static int ub_bd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - struct gendisk *disk = inode->i_bdev->bd_disk; void __user *usermem = (void __user *) arg; - return scsi_cmd_ioctl(filp, disk->queue, disk, cmd, usermem); + return scsi_cmd_blk_ioctl(filp, inode->i_bdev, cmd, usermem); } /* diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 42251095134..e498a9d8c0f 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -149,8 +149,7 @@ static void do_virtblk_request(struct request_queue *q) static int virtblk_ioctl(struct inode *inode, struct file *filp, unsigned cmd, unsigned long data) { - return scsi_cmd_ioctl(filp, inode->i_bdev->bd_disk->queue, - inode->i_bdev->bd_disk, cmd, + return scsi_cmd_blk_ioctl(filp, inode->i_bdev, cmd, (void __user *)data); } diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 74031de517e..ba79dac01ac 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2667,12 +2667,11 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi, { void __user *argp = (void __user *)arg; int ret; - struct gendisk *disk = ip->i_bdev->bd_disk; /* * Try the generic SCSI command ioctl's first. */ - ret = scsi_cmd_ioctl(file, disk->queue, disk, cmd, argp); + ret = scsi_cmd_blk_ioctl(file, ip->i_bdev, cmd, argp); if (ret != -ENOTTY) return ret; diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index e9034c0125f..f773f5936ce 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -1337,8 +1337,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, * and CDROM_SEND_PACKET (legacy) ioctls */ if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) - err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, - bdev->bd_disk, cmd, argp); + err = scsi_cmd_blk_ioctl(file, bdev, cmd, argp); else err = -ENOTTY; diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 00751a1296e..92fb11478b0 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -769,7 +769,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp, case SCSI_IOCTL_GET_BUS_NUMBER: return scsi_ioctl(sdp, cmd, p); default: - error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p); + error = scsi_cmd_blk_ioctl(filp, bdev, cmd, p); if (error != -ENOTTY) return error; } |