scsi: qla2xxx: Make qla2x00_abort_srb() again decrease the sp reference count
authorBart Van Assche <bvanassche@acm.org>
Fri, 9 Aug 2019 03:01:22 +0000 (20:01 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Aug 2019 01:34:04 +0000 (21:34 -0400)
Since qla2x00_abort_srb() starts with increasing the reference count of
@sp, decrease that same reference count before returning.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Fixes: 219d27d7147e ("scsi: qla2xxx: Fix race conditions in the code for aborting SCSI commands") # v5.2.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Himanshu Madhani <hmadhani@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_os.c

index 17a3f91ba5a31e8f7a8dc3ca8052d1d537cd6db1..b667f13b62df088b3078422e8e8a256de156e986 100644 (file)
@@ -1755,6 +1755,8 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res,
                spin_lock_irqsave(qp->qp_lock_ptr, *flags);
                sp->comp = NULL;
        }
+
+       atomic_dec(&sp->ref_count);
 }
 
 static void