]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: qla2xxx: Fix imbalance vha->vref_count
authorQuinn Tran <qutran@marvell.com>
Wed, 13 Jul 2022 05:20:41 +0000 (22:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:16 +0000 (14:24 +0200)
commit dfe58feb1f0e4e6bcbb83cf46b94b58034daefcf upstream.

vref_count took an extra decrement in the task management path.  Add an
extra ref count to compensate the imbalance.

Link: https://lore.kernel.org/r/20220713052045.10683-7-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/qla2xxx/qla_init.c

index edc29d6ebb283752e5aea57ccf49d8803ddd1405..218eeb439b8435cd803f55708f7bd08ce7883976 100644 (file)
@@ -161,6 +161,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
        struct srb_iocb *abt_iocb;
        srb_t *sp;
        int rval = QLA_FUNCTION_FAILED;
+       uint8_t bail;
 
        /* ref: INIT for ABTS command */
        sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport,
@@ -168,6 +169,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
        if (!sp)
                return QLA_MEMORY_ALLOC_FAILED;
 
+       QLA_VHA_MARK_BUSY(vha, bail);
        abt_iocb = &sp->u.iocb_cmd;
        sp->type = SRB_ABT_CMD;
        sp->name = "abort";
@@ -2009,12 +2011,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
        struct srb_iocb *tm_iocb;
        srb_t *sp;
        int rval = QLA_FUNCTION_FAILED;
+       uint8_t bail;
 
        /* ref: INIT */
        sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
        if (!sp)
                goto done;
 
+       QLA_VHA_MARK_BUSY(vha, bail);
        sp->type = SRB_TM_CMD;
        sp->name = "tmf";
        qla2x00_init_async_sp(sp, qla2x00_get_async_timeout(vha),