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 <hmadhani@xxxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > 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? Best regards, Roman