summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/aachba.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-25 22:49:55 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-07-26 22:09:21 -0400
commite6fd916a625110d75bd4d15b8488df44cf41c9fc (patch)
tree2fc0bb5a15efd7fac015f06e5ab7a43526949c17 /drivers/scsi/aacraid/aachba.c
parent722477c4f2c50bc8d800d293a3bc5aa843f16e8d (diff)
downloadblackbird-obmc-linux-e6fd916a625110d75bd4d15b8488df44cf41c9fc.tar.gz
blackbird-obmc-linux-e6fd916a625110d75bd4d15b8488df44cf41c9fc.zip
scsi: aacraid: reading out of bounds
"qd.id" comes directly from the copy_from_user() on the line before so we should verify that it's within bounds. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r--drivers/scsi/aacraid/aachba.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 707ee2f5954d..4591113c49de 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -3198,10 +3198,11 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
return -EBUSY;
if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))
return -EFAULT;
- if (qd.cnum == -1)
+ if (qd.cnum == -1) {
+ if (qd.id < 0 || qd.id >= dev->maximum_num_containers)
+ return -EINVAL;
qd.cnum = qd.id;
- else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))
- {
+ } else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) {
if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
return -EINVAL;
qd.instance = dev->scsi_host_ptr->host_no;
OpenPOWER on IntegriCloud