On 8/12/19 1:52 PM, Roman Bolshakov wrote:
On Thu, Aug 08, 2019 at 08:02:07PM -0700, Bart Van Assche wrote:
Avoid that this function crashes if mcmd == NULL.

Cc: Himanshu Madhani <hmadh...@marvell.com>
Signed-off-by: Bart Van Assche <bvanass...@acm.org>
---
  drivers/scsi/qla2xxx/qla_target.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index d25c3fa43601..cc0c99b5f3fb 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -5731,7 +5731,7 @@ static void qlt_handle_abts_completion(struct 
scsi_qla_host *vha,
                            entry->error_subcode2);
                        ha->tgt.tgt_ops->free_mcmd(mcmd);
                }
-       } else {
+       } else if (mcmd) {
                ha->tgt.tgt_ops->free_mcmd(mcmd);
        }
  }
--
2.22.0


Thanks for working on the fix, the crash can be observed sometimes on
target shutdown.

I've been inspecting the piece of code multiple times and still don't
understand if we get mcmd == NULL only when ABTS completes successfully
or there is ABTS failure together with inability to find mcmd in the
request queue? In that case, there're two more paths that could crash.

And the second question is whether the NULL received from
qlt_ctio_to_cmd is a sign of another sporadic issue somewhere else in
the driver?

Hi Roman,

If I interpret qlt_handle_abts_completion() mcmd can only be NULL at line 5734 if h == QLA_TGT_SKIP_HANDLE. I'm not sure what causes the firmware to report that handle value upon ABTS completion.

Bart.

Reply via email to