scsi: sg: off by one in sg_ioctl()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 17 Aug 2017 07:09:54 +0000 (10:09 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Sep 2017 12:39:22 +0000 (14:39 +0200)
commitc6b9a2007c92cc0bcf2b947ed369fffe1652197e
treea507d08eb09e03d0138ed0556f226f28375e7604
parent2b2d86b0d43dd46dce468de308899d488e91fb30
scsi: sg: off by one in sg_ioctl()

commit bd46fc406b30d1db1aff8dabaff8d18bb423fdcf upstream.

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

Fixes: 109bade9c625 ("scsi: sg: use standard lists for sg_requests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sg.c