Skip to content

Commit

Permalink
nfsd: Check queue type before submitting a SCSI request
Browse files Browse the repository at this point in the history
Since using scsi_req() is only allowed against request queues for
which struct scsi_request is the first member of their private
request data, refuse to submit SCSI commands against a queue for
which this is not the case.

References: commit 82ed4db ("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>
Acked-by: J. Bruce Fields <bfields@redhat.com>
Cc: Jeff Layton <jlayton@poochiereds.net>
Cc: Omar Sandoval <osandov@fb.com>
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Bart Van Assche authored and Jens Axboe committed Jun 1, 2017
1 parent 73d1770 commit 30181fa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/nfsd/blocklayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,
u8 *buf, *d, type, assoc;
int error;

if (WARN_ON_ONCE(!blk_queue_scsi_passthrough(q)))
return -EINVAL;

buf = kzalloc(bufflen, GFP_KERNEL);
if (!buf)
return -ENOMEM;
Expand Down

0 comments on commit 30181fa

Please sign in to comment.