Commit bd46fc40 authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin K. Petersen

scsi: sg: off by one in sg_ioctl()

If "val" is SG_MAX_QUEUE then we are one element beyond the end of the
"rinfo" array so the > should be >=.

Fixes: 109bade9 ("scsi: sg: use standard lists for sg_requests")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 723cd772
...@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) ...@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
read_lock_irqsave(&sfp->rq_list_lock, iflags); read_lock_irqsave(&sfp->rq_list_lock, iflags);
val = 0; val = 0;
list_for_each_entry(srp, &sfp->rq_list, entry) { list_for_each_entry(srp, &sfp->rq_list, entry) {
if (val > SG_MAX_QUEUE) if (val >= SG_MAX_QUEUE)
break; break;
memset(&rinfo[val], 0, SZ_SG_REQ_INFO); memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
rinfo[val].req_state = srp->done + 1; rinfo[val].req_state = srp->done + 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment