Skip to content

Commit 62b54cc

Browse files
bwh-ctgregkh
authored andcommitted
scsi: sg: Re-fix off by one in sg_fill_request_table()
commit 587c3c9f286cee5c9cac38d28c8ae1875f4ec85b upstream. Commit 109bade9c625 ("scsi: sg: use standard lists for sg_requests") introduced an off-by-one error in sg_ioctl(), which was fixed by commit bd46fc406b30 ("scsi: sg: off by one in sg_ioctl()"). Unfortunately commit 4759df905a47 ("scsi: sg: factor out sg_fill_request_table()") moved that code, and reintroduced the bug (perhaps due to a botched rebase). Fix it again. Fixes: 4759df905a47 ("scsi: sg: factor out sg_fill_request_table()") Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> 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>
1 parent 6e9abbc commit 62b54cc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/scsi/sg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo)
848848

849849
val = 0;
850850
list_for_each_entry(srp, &sfp->rq_list, entry) {
851-
if (val > SG_MAX_QUEUE)
851+
if (val >= SG_MAX_QUEUE)
852852
break;
853853
rinfo[val].req_state = srp->done + 1;
854854
rinfo[val].problem =

0 commit comments

Comments
 (0)