mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
block: add and use scsi_blk_cmd_ioctl
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: [email protected] Cc: Jens Axboe <[email protected]> Cc: James Bottomley <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
81d48f0aee
commit
577ebb374c
8 changed files with 18 additions and 12 deletions
|
|
@ -1735,7 +1735,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
|||
case CCISS_BIG_PASSTHRU:
|
||||
return cciss_bigpassthru(h, argp);
|
||||
|
||||
/* 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:
|
||||
|
|
@ -1746,9 +1746,9 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
|||
case SG_EMULATED_HOST:
|
||||
case SG_IO:
|
||||
case SCSI_IOCTL_SEND_COMMAND:
|
||||
return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
|
||||
return scsi_cmd_blk_ioctl(bdev, mode, 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. */
|
||||
|
|
|
|||
|
|
@ -1744,12 +1744,11 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode)
|
|||
static int ub_bd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
void __user *usermem = (void __user *) arg;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&ub_mutex);
|
||||
ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem);
|
||||
ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, usermem);
|
||||
mutex_unlock(&ub_mutex);
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -250,8 +250,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
|
|||
if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
|
||||
return -ENOTTY;
|
||||
|
||||
return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
|
||||
(void __user *)data);
|
||||
return scsi_cmd_blk_ioctl(bdev, mode, cmd,
|
||||
(void __user *)data);
|
||||
}
|
||||
|
||||
/* We provide getgeo only to please some old bootloader/partitioning tools */
|
||||
|
|
|
|||
Loading…
Reference in a new issue