Skip to content

Commit

Permalink
qla2x00t-32gbit: Fix off by one in qla_edif_app_getstats()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Himanshu Madhani <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
[ commit 4406e4176f47 upstream ]
  • Loading branch information
lnocturno committed May 3, 2024
1 parent 6c6f675 commit 3e0408f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qla2x00t-32gbit/qla_edif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 3e0408f

Please sign in to comment.