]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: qla2xxx: edif: Fix off by one bug in qla_edif_app_getfcinfo()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 9 Nov 2021 11:52:19 +0000 (14:52 +0300)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:34:38 +0000 (07:34 +0100)
BugLink: https://bugs.launchpad.net/bugs/1953370
[ Upstream commit e11e285b9cd132db21568b5d29c291f590841944 ]

The > comparison needs to be >= to prevent accessing one element beyond the
end of the app_reply->ports[] array.

Link: https://lore.kernel.org/r/20211109115219.GE16587@kili
Fixes: 7878f22a2e03 ("scsi: qla2xxx: edif: Add getfcinfo and statistic bsgs")
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/scsi/qla2xxx/qla_edif.c

index 9240e788b011de1fc0d333ea72bc9f1dfcd6af95..a04693498dc013d61f904fd96bd289094409b63a 100644 (file)
@@ -865,7 +865,7 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
                            "APP request entry - portid=%06x.\n", tdid.b24);
 
                        /* Ran out of space */
-                       if (pcnt > app_req.num_ports)
+                       if (pcnt >= app_req.num_ports)
                                break;
 
                        if (tdid.b24 != 0 && tdid.b24 != fcport->d_id.b24)