Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2018-10-12 12:14:58 +0200
committerHannes Reinecke <hare@suse.de>2018-10-12 12:40:42 +0200
commit50fe149ecda02d129659b6e270a6c0eca1145cd6 (patch)
treed2f7145fd566462c613ff6571eda1949fa2a8c0a
parent253059723812689a3587c55bb17493a688b0a54b (diff)
scsi: qla2xxx: Move log messages before issuing command to
firmware (bsc#1108870).
-rw-r--r--patches.fixes/scsi-qla2xxx-Move-log-messages-before-issuing-comman.patch194
-rw-r--r--series.conf1
2 files changed, 195 insertions, 0 deletions
diff --git a/patches.fixes/scsi-qla2xxx-Move-log-messages-before-issuing-comman.patch b/patches.fixes/scsi-qla2xxx-Move-log-messages-before-issuing-comman.patch
new file mode 100644
index 0000000000..30008dd43f
--- /dev/null
+++ b/patches.fixes/scsi-qla2xxx-Move-log-messages-before-issuing-comman.patch
@@ -0,0 +1,194 @@
+From: Giridhar Malavali <giridhar.malavali@cavium.com>
+Date: Wed, 26 Sep 2018 22:05:18 -0700
+Subject: [PATCH] scsi: qla2xxx: Move log messages before issuing command to firmware
+Git-commit: 9fe278f44b4bc06cc61e33b2af65f87d507d13d0
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
+Patch-mainline: Queued in subsystem maintainer repository
+References: bsc#1108870
+
+There is a probability that the SRB structure might have been released by the
+time the debug log message dereferences it. This patch moved the log messages
+before the command is issued to the firmware to prevent unknown behavior and
+kernel crash
+
+Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
+Reviewed-by: Ewan D. Milne <emilne@redhat.com>
+Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Hannes Reinecke <hare@suse.com>
+---
+ drivers/scsi/qla2xxx/qla_gs.c | 15 +++++++------
+ drivers/scsi/qla2xxx/qla_init.c | 48 +++++++++++++++++++++--------------------
+ 2 files changed, 33 insertions(+), 30 deletions(-)
+
+diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
+index f4e8e9db7d2d..90cfa394f942 100644
+--- a/drivers/scsi/qla2xxx/qla_gs.c
++++ b/drivers/scsi/qla2xxx/qla_gs.c
+@@ -3124,15 +3124,15 @@ int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport)
+ sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
+ sp->done = qla24xx_async_gpsc_sp_done;
+
+- rval = qla2x00_start_sp(sp);
+- if (rval != QLA_SUCCESS)
+- goto done_free_sp;
+-
+ ql_dbg(ql_dbg_disc, vha, 0x205e,
+ "Async-%s %8phC hdl=%x loopid=%x portid=%02x%02x%02x.\n",
+ sp->name, fcport->port_name, sp->handle,
+ fcport->loop_id, fcport->d_id.b.domain,
+ fcport->d_id.b.area, fcport->d_id.b.al_pa);
++
++ rval = qla2x00_start_sp(sp);
++ if (rval != QLA_SUCCESS)
++ goto done_free_sp;
+ return rval;
+
+ done_free_sp:
+@@ -3450,13 +3450,14 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_id_t *id)
+ sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
+ sp->done = qla2x00_async_gpnid_sp_done;
+
++ ql_dbg(ql_dbg_disc, vha, 0x2067,
++ "Async-%s hdl=%x ID %3phC.\n", sp->name,
++ sp->handle, ct_req->req.port_id.port_id);
++
+ rval = qla2x00_start_sp(sp);
+ if (rval != QLA_SUCCESS)
+ goto done_free_sp;
+
+- ql_dbg(ql_dbg_disc, vha, 0x2067,
+- "Async-%s hdl=%x ID %3phC.\n", sp->name,
+- sp->handle, ct_req->req.port_id.port_id);
+ return rval;
+
+ done_free_sp:
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
+index c898deeae4af..ea7951eb05ce 100644
+--- a/drivers/scsi/qla2xxx/qla_init.c
++++ b/drivers/scsi/qla2xxx/qla_init.c
+@@ -247,6 +247,12 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
+
+ }
+
++ ql_dbg(ql_dbg_disc, vha, 0x2072,
++ "Async-login - %8phC hdl=%x, loopid=%x portid=%02x%02x%02x "
++ "retries=%d.\n", fcport->port_name, sp->handle, fcport->loop_id,
++ fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa,
++ fcport->login_retry);
++
+ rval = qla2x00_start_sp(sp);
+ if (rval != QLA_SUCCESS) {
+ fcport->flags |= FCF_LOGIN_NEEDED;
+@@ -254,11 +260,6 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
+ goto done_free_sp;
+ }
+
+- ql_dbg(ql_dbg_disc, vha, 0x2072,
+- "Async-login - %8phC hdl=%x, loopid=%x portid=%02x%02x%02x "
+- "retries=%d.\n", fcport->port_name, sp->handle, fcport->loop_id,
+- fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa,
+- fcport->login_retry);
+ return rval;
+
+ done_free_sp:
+@@ -303,15 +304,16 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport)
+ qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
+
+ sp->done = qla2x00_async_logout_sp_done;
+- rval = qla2x00_start_sp(sp);
+- if (rval != QLA_SUCCESS)
+- goto done_free_sp;
+
+ ql_dbg(ql_dbg_disc, vha, 0x2070,
+ "Async-logout - hdl=%x loop-id=%x portid=%02x%02x%02x %8phC.\n",
+ sp->handle, fcport->loop_id, fcport->d_id.b.domain,
+ fcport->d_id.b.area, fcport->d_id.b.al_pa,
+ fcport->port_name);
++
++ rval = qla2x00_start_sp(sp);
++ if (rval != QLA_SUCCESS)
++ goto done_free_sp;
+ return rval;
+
+ done_free_sp:
+@@ -491,13 +493,15 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport,
+ sp->done = qla2x00_async_adisc_sp_done;
+ if (data[1] & QLA_LOGIO_LOGIN_RETRIED)
+ lio->u.logio.flags |= SRB_LOGIN_RETRIED;
+- rval = qla2x00_start_sp(sp);
+- if (rval != QLA_SUCCESS)
+- goto done_free_sp;
+
+ ql_dbg(ql_dbg_disc, vha, 0x206f,
+ "Async-adisc - hdl=%x loopid=%x portid=%06x %8phC.\n",
+ sp->handle, fcport->loop_id, fcport->d_id.b24, fcport->port_name);
++
++ rval = qla2x00_start_sp(sp);
++ if (rval != QLA_SUCCESS)
++ goto done_free_sp;
++
+ return rval;
+
+ done_free_sp:
+@@ -1156,14 +1160,13 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt)
+
+ sp->done = qla24xx_async_gpdb_sp_done;
+
+- rval = qla2x00_start_sp(sp);
+- if (rval != QLA_SUCCESS)
+- goto done_free_sp;
+-
+ ql_dbg(ql_dbg_disc, vha, 0x20dc,
+ "Async-%s %8phC hndl %x opt %x\n",
+ sp->name, fcport->port_name, sp->handle, opt);
+
++ rval = qla2x00_start_sp(sp);
++ if (rval != QLA_SUCCESS)
++ goto done_free_sp;
+ return rval;
+
+ done_free_sp:
+@@ -1761,15 +1764,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
+ tm_iocb->u.tmf.data = tag;
+ sp->done = qla2x00_tmf_sp_done;
+
+- rval = qla2x00_start_sp(sp);
+- if (rval != QLA_SUCCESS)
+- goto done_free_sp;
+-
+ ql_dbg(ql_dbg_taskm, vha, 0x802f,
+ "Async-tmf hdl=%x loop-id=%x portid=%02x%02x%02x.\n",
+ sp->handle, fcport->loop_id, fcport->d_id.b.domain,
+ fcport->d_id.b.area, fcport->d_id.b.al_pa);
+
++ rval = qla2x00_start_sp(sp);
++ if (rval != QLA_SUCCESS)
++ goto done_free_sp;
+ wait_for_completion(&tm_iocb->u.tmf.comp);
+
+ rval = tm_iocb->u.tmf.data;
+@@ -1850,14 +1852,14 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
+
+ sp->done = qla24xx_abort_sp_done;
+
+- rval = qla2x00_start_sp(sp);
+- if (rval != QLA_SUCCESS)
+- goto done_free_sp;
+-
+ ql_dbg(ql_dbg_async, vha, 0x507c,
+ "Abort command issued - hdl=%x, type=%x\n",
+ cmd_sp->handle, cmd_sp->type);
+
++ rval = qla2x00_start_sp(sp);
++ if (rval != QLA_SUCCESS)
++ goto done_free_sp;
++
+ if (wait) {
+ wait_for_completion(&abt_iocb->u.abt.comp);
+ rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ?
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 227baac3a4..4d0c949ef9 100644
--- a/series.conf
+++ b/series.conf
@@ -17928,6 +17928,7 @@
patches.fixes/scsi-qla2xxx-Fix-driver-hang-when-FC-NVMe-LUNs-are-c.patch
patches.fixes/scsi-qla2xxx-Fix-recursive-mailbox-timeout.patch
patches.fixes/scsi-qla2xxx-Fix-for-double-free-of-SRB-structure.patch
+ patches.fixes/scsi-qla2xxx-Move-log-messages-before-issuing-comman.patch
# git://git.infradead.org/nvme.git nvme-4.20
patches.fixes/nvme_fc-add-nvme_discovery-sysfs-attribute-to-fc-tra.patch