Commit db0f166e authored by Bill Kuzeja's avatar Bill Kuzeja Committed by Martin K. Petersen

scsi: qla2xxx: Fix panic in qla_dfs_tgt_counters_show

When trying to display tgt_counters in the debugfs, a panic can result.

There is no null check for qpair after it is assigned in the for-loop.
Unless vha->hw->queue_pair_map array is completely filled with entries, the
system will panic dereferencing a null pointer.
Signed-off-by: default avatarBill Kuzeja <william.kuzeja@stratus.com>
Acked-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 31b6a05f
...@@ -193,6 +193,8 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused) ...@@ -193,6 +193,8 @@ qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
for (i = 0; i < vha->hw->max_qpairs; i++) { for (i = 0; i < vha->hw->max_qpairs; i++) {
qpair = vha->hw->queue_pair_map[i]; qpair = vha->hw->queue_pair_map[i];
if (!qpair)
continue;
qla_core_sbt_cmd += qpair->tgt_counters.qla_core_sbt_cmd; qla_core_sbt_cmd += qpair->tgt_counters.qla_core_sbt_cmd;
core_qla_que_buf += qpair->tgt_counters.core_qla_que_buf; core_qla_que_buf += qpair->tgt_counters.core_qla_que_buf;
qla_core_ret_ctio += qpair->tgt_counters.qla_core_ret_ctio; qla_core_ret_ctio += qpair->tgt_counters.qla_core_ret_ctio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment