Since qla2x00_abort_srb() starts with increasing the reference count of
@sp, decrease that same reference count before returning.

Cc: Himanshu Madhani <hmadh...@marvell.com>
Cc: Giridhar Malavali <gmalav...@marvell.com>
Fixes: 219d27d7147e ("scsi: qla2xxx: Fix race conditions in the code for 
aborting SCSI commands") # v5.2.
Signed-off-by: Bart Van Assche <bvanass...@acm.org>
---
 drivers/scsi/qla2xxx/qla_os.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d056f5e7cf93..1bdf634e7117 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1746,6 +1746,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
-- 
2.22.0.rc3

Reply via email to