diff mbox series

qla2xxx: Return switch command on a timeout

Message ID 20180928180238.14432-1-himanshu.madhani@cavium.com (mailing list archive)
State Accepted
Headers show
Series qla2xxx: Return switch command on a timeout | expand

Commit Message

Madhani, Himanshu Sept. 28, 2018, 6:02 p.m. UTC
This patch fixes commit bcc71cc3cde1468958a3ea859276d8d1a1a68265
which misplaced code in worng routines.

Also updated the use of WARN_ON() to WARN_ON_ONCE() to prevent flooding
log messages.

Fixes: bcc71cc3cde1 ("scsi: qla2xxx: Fix for double free of SRB structure")
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
Hi Martin,

I noticed patch got applied incorrectly on the tree, So sending this correction
patch to fix it. 

Please apply to 4.20/scsi-queue at your earliest convenience. 

Thanks,
Himanshu
---
 drivers/scsi/qla2xxx/qla_init.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Martin K. Petersen Sept. 28, 2018, 10:01 p.m. UTC | #1
Himanshu,

> This patch fixes commit bcc71cc3cde1468958a3ea859276d8d1a1a68265 which
> misplaced code in worng routines.
>
> Also updated the use of WARN_ON() to WARN_ON_ONCE() to prevent
> flooding log messages.

Applied to 4.20/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index ea7951eb05ce..c72d8012fe2a 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -54,7 +54,7 @@  qla2x00_sp_timeout(struct timer_list *t)
 	unsigned long flags;
 	struct qla_hw_data *ha = sp->vha->hw;
 
-	WARN_ON(irqs_disabled());
+	WARN_ON_ONCE(irqs_disabled());
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 	req = sp->qpair->req;
 	req->outstanding_cmds[sp->handle] = NULL;
@@ -792,6 +792,9 @@  qla24xx_async_gnl_sp_done(void *s, int res)
 	    sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1],
 	    sp->u.iocb_cmd.u.mbx.in_mb[2]);
 
+	if (res == QLA_FUNCTION_TIMEOUT)
+		return;
+
 	sp->fcport->flags &= ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE);
 	memset(&ea, 0, sizeof(ea));
 	ea.sp = sp;
@@ -974,17 +977,13 @@  void qla24xx_async_gpdb_sp_done(void *s, int res)
 	    "Async done-%s res %x, WWPN %8phC mb[1]=%x mb[2]=%x \n",
 	    sp->name, res, fcport->port_name, mb[1], mb[2]);
 
-	fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
-
-	if (res == QLA_FUNCTION_TIMEOUT)
-		return;
-
 	if (res == QLA_FUNCTION_TIMEOUT) {
 		dma_pool_free(sp->vha->hw->s_dma_pool, sp->u.iocb_cmd.u.mbx.in,
 			sp->u.iocb_cmd.u.mbx.in_dma);
 		return;
 	}
 
+	fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
 	memset(&ea, 0, sizeof(ea));
 	ea.event = FCME_GPDB_DONE;
 	ea.fcport = fcport;