From: Gleb C. <lna...@ya...> - 2024-05-03 09:54:23
|
Commit: 3e0408f GitHub URL: https://github.com/SCST-project/scst/commit/3e0408fca6e91e6bc4867c9103c12642c2eaf4b6 Author: Gleb Chesnokov Date: 2024-05-03T12:50:49+03:00 Log Message: ----------- qla2x00t-32gbit: Fix off by one in qla_edif_app_getstats() The app_reply->elem[] array is allocated earlier in this function and it has app_req.num_ports elements. Thus this > comparison needs to be >= to prevent memory corruption. Fixes: 7878f22a2e03 ("scsi: qla2xxx: edif: Add getfcinfo and statistic bsgs") Signed-off-by: Dan Carpenter <dan...@li...> Link: https://lore.kernel.org/r/5c1...@mo...untain Reviewed-by: Himanshu Madhani <him...@or...> Signed-off-by: Martin K. Petersen <mar...@or...> [ commit 4406e4176f47 upstream ] Modified Paths: -------------- qla2x00t-32gbit/qla_edif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_edif.c b/qla2x00t-32gbit/qla_edif.c index 96b45f6..1ce6c82 100644 --- a/qla2x00t-32gbit/qla_edif.c +++ b/qla2x00t-32gbit/qla_edif.c @@ -1101,7 +1101,7 @@ qla_edif_app_getstats(scsi_qla_host_t *vha, BSG_JOB_TYPE *bsg_job) list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { if (fcport->edif.enable) { - if (pcnt > app_req.num_ports) + if (pcnt >= app_req.num_ports) break; app_reply->elem[pcnt].rekey_count = |