|
|
3c6e85 |
From 1b8fc153103d4830579b8675af6318855e26ab03 Mon Sep 17 00:00:00 2001
|
|
|
3c6e85 |
From: Himanshu Madhani <hmadhani@redhat.com>
|
|
|
3c6e85 |
Date: Thu, 21 Nov 2019 16:36:54 -0500
|
|
|
3c6e85 |
Subject: [PATCH 144/155] [scsi] scsi: qla2xxx: Fix SRB leak on switch command
|
|
|
3c6e85 |
timeout
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Message-id: <20191121163701.43688-20-hmadhani@redhat.com>
|
|
|
3c6e85 |
Patchwork-id: 287864
|
|
|
3c6e85 |
O-Subject: [RHLE 7.8 e-stor PATCH v3 19/26] scsi: qla2xxx: Fix SRB leak on switch command timeout
|
|
|
3c6e85 |
Bugzilla: 1731581
|
|
|
3c6e85 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
3c6e85 |
RH-Acked-by: Ewan Milne <emilne@redhat.com>
|
|
|
3c6e85 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
3c6e85 |
|
|
|
3c6e85 |
From: Quinn Tran <qutran@marvell.com>
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Bugzilla 1731581
|
|
|
3c6e85 |
|
|
|
3c6e85 |
when GPSC/GPDB switch command fails, driver just returns without doing a
|
|
|
3c6e85 |
proper cleanup. This patch fixes this memory leak by calling sp->free() in
|
|
|
3c6e85 |
the error path.
|
|
|
3c6e85 |
|
|
|
3c6e85 |
Link: https://lore.kernel.org/r/20191105150657.8092-4-hmadhani@marvell.com
|
|
|
3c6e85 |
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
|
|
|
3c6e85 |
Signed-off-by: Quinn Tran <qutran@marvell.com>
|
|
|
3c6e85 |
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
|
|
|
3c6e85 |
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
|
3c6e85 |
(cherry picked from commit af2a0c51b1205327f55a7e82e530403ae1d42cbb)
|
|
|
3c6e85 |
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
|
|
|
3c6e85 |
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
|
|
3c6e85 |
---
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_gs.c | 2 +-
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_init.c | 11 +++++------
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_mbx.c | 4 ----
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_mid.c | 11 ++++-------
|
|
|
3c6e85 |
drivers/scsi/qla2xxx/qla_os.c | 7 ++++++-
|
|
|
3c6e85 |
5 files changed, 16 insertions(+), 19 deletions(-)
|
|
|
3c6e85 |
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
|
|
|
3c6e85 |
index 592ae70a4abd..295f856cb8b7 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_gs.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_gs.c
|
|
|
3c6e85 |
@@ -3043,7 +3043,7 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res)
|
|
|
3c6e85 |
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
if (res == QLA_FUNCTION_TIMEOUT)
|
|
|
3c6e85 |
- return;
|
|
|
3c6e85 |
+ goto done;
|
|
|
3c6e85 |
|
|
|
3c6e85 |
if (res == (DID_ERROR << 16)) {
|
|
|
3c6e85 |
/* entry status error */
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
|
|
|
3c6e85 |
index d6feda133149..16ad80836fb7 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_init.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_init.c
|
|
|
3c6e85 |
@@ -1164,19 +1164,18 @@ void qla24xx_async_gpdb_sp_done(void *s, int res)
|
|
|
3c6e85 |
"Async done-%s res %x, WWPN %8phC mb[1]=%x mb[2]=%x \n",
|
|
|
3c6e85 |
sp->name, res, fcport->port_name, mb[1], mb[2]);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
- if (res == QLA_FUNCTION_TIMEOUT) {
|
|
|
3c6e85 |
- dma_pool_free(sp->vha->hw->s_dma_pool, sp->u.iocb_cmd.u.mbx.in,
|
|
|
3c6e85 |
- sp->u.iocb_cmd.u.mbx.in_dma);
|
|
|
3c6e85 |
- return;
|
|
|
3c6e85 |
- }
|
|
|
3c6e85 |
-
|
|
|
3c6e85 |
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
|
|
|
3c6e85 |
+
|
|
|
3c6e85 |
+ if (res == QLA_FUNCTION_TIMEOUT)
|
|
|
3c6e85 |
+ goto done;
|
|
|
3c6e85 |
+
|
|
|
3c6e85 |
memset(&ea, 0, sizeof(ea));
|
|
|
3c6e85 |
ea.fcport = fcport;
|
|
|
3c6e85 |
ea.sp = sp;
|
|
|
3c6e85 |
|
|
|
3c6e85 |
qla24xx_handle_gpdb_event(vha, &ea);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
+done:
|
|
|
3c6e85 |
dma_pool_free(ha->s_dma_pool, sp->u.iocb_cmd.u.mbx.in,
|
|
|
3c6e85 |
sp->u.iocb_cmd.u.mbx.in_dma);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
|
|
|
3c6e85 |
index d66577789cce..bf7c8d2bb52c 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_mbx.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
|
|
|
3c6e85 |
@@ -6288,17 +6288,13 @@ int qla24xx_send_mb_cmd(struct scsi_qla_host *vha, mbx_cmd_t *mcp)
|
|
|
3c6e85 |
case QLA_SUCCESS:
|
|
|
3c6e85 |
ql_dbg(ql_dbg_mbx, vha, 0x119d, "%s: %s done.\n",
|
|
|
3c6e85 |
__func__, sp->name);
|
|
|
3c6e85 |
- sp->free(sp);
|
|
|
3c6e85 |
break;
|
|
|
3c6e85 |
default:
|
|
|
3c6e85 |
ql_dbg(ql_dbg_mbx, vha, 0x119e, "%s: %s Failed. %x.\n",
|
|
|
3c6e85 |
__func__, sp->name, rval);
|
|
|
3c6e85 |
- sp->free(sp);
|
|
|
3c6e85 |
break;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
|
|
|
3c6e85 |
- return rval;
|
|
|
3c6e85 |
-
|
|
|
3c6e85 |
done_free_sp:
|
|
|
3c6e85 |
sp->free(sp);
|
|
|
3c6e85 |
done:
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
|
|
|
3c6e85 |
index 203188563735..55276b65ddae 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_mid.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_mid.c
|
|
|
3c6e85 |
@@ -933,7 +933,7 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
|
|
|
3c6e85 |
|
|
|
3c6e85 |
sp = qla2x00_get_sp(base_vha, NULL, GFP_KERNEL);
|
|
|
3c6e85 |
if (!sp)
|
|
|
3c6e85 |
- goto done;
|
|
|
3c6e85 |
+ return rval;
|
|
|
3c6e85 |
|
|
|
3c6e85 |
sp->type = SRB_CTRL_VP;
|
|
|
3c6e85 |
sp->name = "ctrl_vp";
|
|
|
3c6e85 |
@@ -949,7 +949,7 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
|
|
|
3c6e85 |
ql_dbg(ql_dbg_async, vha, 0xffff,
|
|
|
3c6e85 |
"%s: %s Failed submission. %x.\n",
|
|
|
3c6e85 |
__func__, sp->name, rval);
|
|
|
3c6e85 |
- goto done_free_sp;
|
|
|
3c6e85 |
+ goto done;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
|
|
|
3c6e85 |
ql_dbg(ql_dbg_vport, vha, 0x113f, "%s hndl %x submitted\n",
|
|
|
3c6e85 |
@@ -967,16 +967,13 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
|
|
|
3c6e85 |
case QLA_SUCCESS:
|
|
|
3c6e85 |
ql_dbg(ql_dbg_vport, vha, 0xffff, "%s: %s done.\n",
|
|
|
3c6e85 |
__func__, sp->name);
|
|
|
3c6e85 |
- goto done_free_sp;
|
|
|
3c6e85 |
+ break;
|
|
|
3c6e85 |
default:
|
|
|
3c6e85 |
ql_dbg(ql_dbg_vport, vha, 0xffff, "%s: %s Failed. %x.\n",
|
|
|
3c6e85 |
__func__, sp->name, rval);
|
|
|
3c6e85 |
- goto done_free_sp;
|
|
|
3c6e85 |
+ break;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
done:
|
|
|
3c6e85 |
- return rval;
|
|
|
3c6e85 |
-
|
|
|
3c6e85 |
-done_free_sp:
|
|
|
3c6e85 |
sp->free(sp);
|
|
|
3c6e85 |
return rval;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
|
|
|
3c6e85 |
index 95d54bbc48c0..4155b45d118e 100644
|
|
|
3c6e85 |
--- a/drivers/scsi/qla2xxx/qla_os.c
|
|
|
3c6e85 |
+++ b/drivers/scsi/qla2xxx/qla_os.c
|
|
|
3c6e85 |
@@ -1023,7 +1023,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
|
|
|
3c6e85 |
ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3078,
|
|
|
3c6e85 |
"Start scsi failed rval=%d for cmd=%p.\n", rval, cmd);
|
|
|
3c6e85 |
if (rval == QLA_INTERFACE_ERROR)
|
|
|
3c6e85 |
- goto qc24_fail_command;
|
|
|
3c6e85 |
+ goto qc24_free_sp_fail_command;
|
|
|
3c6e85 |
goto qc24_host_busy_free_sp;
|
|
|
3c6e85 |
}
|
|
|
3c6e85 |
|
|
|
3c6e85 |
@@ -1035,6 +1035,11 @@ qc24_host_busy_free_sp:
|
|
|
3c6e85 |
qc24_target_busy:
|
|
|
3c6e85 |
return SCSI_MLQUEUE_TARGET_BUSY;
|
|
|
3c6e85 |
|
|
|
3c6e85 |
+qc24_free_sp_fail_command:
|
|
|
3c6e85 |
+ sp->free(sp);
|
|
|
3c6e85 |
+ CMD_SP(cmd) = NULL;
|
|
|
3c6e85 |
+ qla2xxx_rel_qpair_sp(sp->qpair, sp);
|
|
|
3c6e85 |
+
|
|
|
3c6e85 |
qc24_fail_command:
|
|
|
3c6e85 |
cmd->scsi_done(cmd);
|
|
|
3c6e85 |
|
|
|
3c6e85 |
--
|
|
|
3c6e85 |
2.13.6
|
|
|
3c6e85 |
|