diff options
author | Christoph Hellwig <hch@lst.de> | 2014-10-24 12:39:37 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-12 05:16:11 -0500 |
commit | 21a9d4c9d6c6bb22dffad67cb82f0037859262b7 (patch) | |
tree | 585ee1325975aecd0cc52318e4ce7b857a1d5137 /drivers/scsi | |
parent | 906d15fbd23c1267addab361063c1c8119992215 (diff) |
sd: fix up ->compat_ioctl
No need to verify the passthrough ioctls, the real handler will
take care of that. Also make sure not to block for resets on
O_NONBLOCK fds.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sd.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ddf763ad3b83..b041eca8955d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1541,31 +1541,19 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, | |||
1541 | unsigned int cmd, unsigned long arg) | 1541 | unsigned int cmd, unsigned long arg) |
1542 | { | 1542 | { |
1543 | struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; | 1543 | struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; |
1544 | int ret; | 1544 | int error; |
1545 | |||
1546 | ret = scsi_verify_blk_ioctl(bdev, cmd); | ||
1547 | if (ret < 0) | ||
1548 | return ret; | ||
1549 | 1545 | ||
1550 | /* | 1546 | error = scsi_ioctl_block_when_processing_errors(sdev, cmd, |
1551 | * If we are in the middle of error recovery, don't let anyone | 1547 | (mode & FMODE_NDELAY) != 0); |
1552 | * else try and use this device. Also, if error recovery fails, it | 1548 | if (error) |
1553 | * may try and take the device offline, in which case all further | 1549 | return error; |
1554 | * access to the device is prohibited. | ||
1555 | */ | ||
1556 | if (!scsi_block_when_processing_errors(sdev)) | ||
1557 | return -ENODEV; | ||
1558 | 1550 | ||
1559 | if (sdev->host->hostt->compat_ioctl) { | ||
1560 | ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); | ||
1561 | |||
1562 | return ret; | ||
1563 | } | ||
1564 | |||
1565 | /* | 1551 | /* |
1566 | * Let the static ioctl translation table take care of it. | 1552 | * Let the static ioctl translation table take care of it. |
1567 | */ | 1553 | */ |
1568 | return -ENOIOCTLCMD; | 1554 | if (!sdev->host->hostt->compat_ioctl) |
1555 | return -ENOIOCTLCMD; | ||
1556 | return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); | ||
1569 | } | 1557 | } |
1570 | #endif | 1558 | #endif |
1571 | 1559 | ||