summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-07-24 09:20:18 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2021-07-28 22:24:25 -0400
commitfb1ba406c451045f1063ace70086b4645d4e9d54 (patch)
treefae603ca1d5f639ddd8db33f7435b851d051a650 /drivers/scsi
parente9ee7fea45787d657c2e56134fa8484382a90444 (diff)
scsi: scsi_ioctl: Remove scsi_cmd_blk_ioctl()
Open code scsi_cmd_blk_ioctl() in its two callers. Link: https://lore.kernel.org/r/20210724072033.1284840-10-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd.c5
-rw-r--r--drivers/scsi/sr.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0b87ca01efff..d65bfe505e08 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1583,7 +1583,10 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
case SCSI_IOCTL_GET_BUS_NUMBER:
break;
default:
- error = scsi_cmd_blk_ioctl(bdev, mode, cmd, p);
+ error = scsi_verify_blk_ioctl(bdev, cmd);
+ if (error < 0)
+ return error;
+ error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p);
if (error != -ENOTTY)
return error;
}
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 7948416f40d5..b903e54c57fd 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -556,7 +556,8 @@ static void sr_block_release(struct gendisk *disk, fmode_t mode)
static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
unsigned long arg)
{
- struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
+ struct gendisk *disk = bdev->bd_disk;
+ struct scsi_cd *cd = scsi_cd(disk);
struct scsi_device *sdev = cd->device;
void __user *argp = (void __user *)arg;
int ret;
@@ -579,7 +580,10 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
case SCSI_IOCTL_GET_BUS_NUMBER:
break;
default:
- ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
+ ret = scsi_verify_blk_ioctl(bdev, cmd);
+ if (ret < 0)
+ goto put;
+ ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
if (ret != -ENOTTY)
goto put;
ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg);