summaryrefslogtreecommitdiff
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-07-24 10:20:19 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2021-07-29 05:24:25 +0300
commit4f07bfc56157ebc689ef54879e90c48a47294083 (patch)
treee9622759f995104badfc5b9d25dbb8ec49b2648f /drivers/scsi/sr.c
parentfb1ba406c451045f1063ace70086b4645d4e9d54 (diff)
downloadlinux-4f07bfc56157ebc689ef54879e90c48a47294083.tar.xz
scsi: scsi_ioctl: Remove scsi_verify_blk_ioctl()
Manually verify that the device is not a partition and the caller has admin privŃ–leges at the beginning of the sr ioctl method and open code the trivial check for sd as well. Link: https://lore.kernel.org/r/20210724072033.1284840-11-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/sr.c')
-rw-r--r--drivers/scsi/sr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index b903e54c57fd..e6eadba4d638 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -562,6 +562,9 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
void __user *argp = (void __user *)arg;
int ret;
+ if (bdev_is_partition(bdev) && !capable(CAP_SYS_RAWIO))
+ return -ENOIOCTLCMD;
+
mutex_lock(&cd->lock);
ret = scsi_ioctl_block_when_processing_errors(sdev, cmd,
@@ -580,9 +583,6 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
case SCSI_IOCTL_GET_BUS_NUMBER:
break;
default:
- 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;