summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-11-13 13:27:41 (GMT)
committerChristoph Hellwig <hch@lst.de>2014-11-24 13:45:26 (GMT)
commit1e6f2416044c062a56091ebf8d76760956dd5872 (patch)
tree53b83ab97cc475c37f957bb85167ae8cb2ccd550 /drivers/scsi/scsi_sysfs.c
parentc40ecc12cfdb630332198a04e2832ae8218a61f1 (diff)
downloadlinux-1e6f2416044c062a56091ebf8d76760956dd5872.tar.xz
scsi: don't allow setting of queue_depth bigger than can_queue
We won't ever queue more commands than the host allows. Instead of letting drivers either reject or ignore this case handle it in common code. Note that various driver use internal constant or variables that are assigned to both shost->can_queue and checked in ->change_queue_depth - I did remove those checks as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 35d93b0..bffd5ab 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -877,7 +877,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr,
depth = simple_strtoul(buf, NULL, 0);
- if (depth < 1)
+ if (depth < 1 || depth > sht->can_queue)
return -EINVAL;
retval = sht->change_queue_depth(sdev, depth,