From dca2301b6a01b42751829b450b9b73047229ec6f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 24 Apr 2019 01:44:26 +0000 Subject: [PATCH] qla2x00t-32gbit: Fix qla24xx_abort_sp_done() Avoid that the complete() and sp->free() calls are ignored if aborting a command times out. Reported-by: Shen Qiyu git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8275 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_init.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/qla2x00t-32gbit/qla_init.c b/qla2x00t-32gbit/qla_init.c index 7bf6ca535..a4524e1e9 100644 --- a/qla2x00t-32gbit/qla_init.c +++ b/qla2x00t-32gbit/qla_init.c @@ -1731,12 +1731,11 @@ qla24xx_abort_sp_done(void *ptr, int res) srb_t *sp = ptr; struct srb_iocb *abt = &sp->u.iocb_cmd; - if (del_timer(&sp->u.iocb_cmd.timer)) { - if (sp->flags & SRB_WAKEUP_ON_COMP) - complete(&abt->u.abt.comp); - else - sp->free(sp); - } + del_timer(&sp->u.iocb_cmd.timer); + if (sp->flags & SRB_WAKEUP_ON_COMP) + complete(&abt->u.abt.comp); + else + sp->free(sp); } int @@ -1750,7 +1749,7 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait) sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport, GFP_ATOMIC); if (!sp) - goto done; + return rval; abt_iocb = &sp->u.iocb_cmd; sp->type = SRB_ABT_CMD; @@ -1774,20 +1773,17 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait) cmd_sp->handle, cmd_sp->type); rval = qla2x00_start_sp(sp); - if (rval != QLA_SUCCESS) - goto done_free_sp; + if (rval != QLA_SUCCESS) { + sp->free(sp); + return rval; + } if (wait) { wait_for_completion(&abt_iocb->u.abt.comp); rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ? QLA_SUCCESS : QLA_FUNCTION_FAILED; - } else { - goto done; } -done_free_sp: - sp->free(sp); -done: return rval; }