From: Bart Van Assche Date: Wed, 31 May 2017 21:43:50 +0000 (-0700) Subject: nfsd: Check queue type before submitting a SCSI request X-Git-Tag: MMI-PSA29.97-13-9~5198^2~92 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=30181faae37fa80d3aa73672e5df5f2a5b8dea0a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git nfsd: Check queue type before submitting a SCSI request 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 82ed4db499b8 ("block: split scsi_request out of struct request") Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Acked-by: J. Bruce Fields Cc: Jeff Layton Cc: Omar Sandoval Cc: linux-nfs@vger.kernel.org Signed-off-by: Jens Axboe --- diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index fb5213afc854..47ed19c53f2e 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c @@ -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;