diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-05-31 17:43:49 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-06-01 15:10:44 -0400 |
commit | 73d17701db503382eeed03afb3a6c39ec4d9a5c7 (patch) | |
tree | 0387060b46a8f75a3701f8006588cb1295e0bff6 /drivers/cdrom/cdrom.c | |
parent | ec2be6a98e50d3eb9f35f70aa51c5d2c23737c55 (diff) |
cdrom: Check SCSI passthrough support before reading audio
The CDROMREADAUDIO ioctl uses SCSI passthrough when the .disk
pointer has been set in struct cdrom_device_info. Hence check
whether SCSI passthrough is supported before submitting a SCSI
command. Note: both the ide-cd and sr drivers set the disk
pointer in struct cdrom_device_info but neither the pcd nor
the gdrom driver sets that pointer.
References: commit 82ed4db499b8 ("block: split scsi_request out of struct request")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Omar Sandoval <osandov@fb.com>
Cc: linux-block@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r-- | drivers/cdrom/cdrom.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 76c952fd9ab9..ff19cfc587f0 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2178,6 +2178,12 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2178 | if (!q) | 2178 | if (!q) |
2179 | return -ENXIO; | 2179 | return -ENXIO; |
2180 | 2180 | ||
2181 | if (!blk_queue_scsi_passthrough(q)) { | ||
2182 | WARN_ONCE(true, | ||
2183 | "Attempt read CDDA info through a non-SCSI queue\n"); | ||
2184 | return -EINVAL; | ||
2185 | } | ||
2186 | |||
2181 | cdi->last_sense = 0; | 2187 | cdi->last_sense = 0; |
2182 | 2188 | ||
2183 | while (nframes) { | 2189 | while (nframes) { |