]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Jun 2019 19:51:13 +0000 (21:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Jun 2019 19:51:13 +0000 (21:51 +0200)
added patches:
scsi-lpfc-fix-backport-of-faf5a744f4f8-scsi-lpfc-avoid-uninitialized-variable-warning.patch

queue-4.19/scsi-lpfc-fix-backport-of-faf5a744f4f8-scsi-lpfc-avoid-uninitialized-variable-warning.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/scsi-lpfc-fix-backport-of-faf5a744f4f8-scsi-lpfc-avoid-uninitialized-variable-warning.patch b/queue-4.19/scsi-lpfc-fix-backport-of-faf5a744f4f8-scsi-lpfc-avoid-uninitialized-variable-warning.patch
new file mode 100644 (file)
index 0000000..351b10d
--- /dev/null
@@ -0,0 +1,48 @@
+From natechancellor@gmail.com  Thu Jun  6 21:42:06 2019
+From: Nathan Chancellor <natechancellor@gmail.com>
+Date: Thu,  6 Jun 2019 10:41:25 -0700
+Subject: scsi: lpfc: Fix backport of faf5a744f4f8 ("scsi: lpfc: avoid uninitialized variable warning")
+To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Pavel Machek <pavel@denx.de>, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, James Smart <james.smart@broadcom.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, Sasha Levin <sashal@kernel.org>, Nathan Chancellor <natechancellor@gmail.com>
+Message-ID: <20190606174125.4277-1-natechancellor@gmail.com>
+
+From: Nathan Chancellor <natechancellor@gmail.com>
+
+Prior to commit 4c47efc140fa ("scsi: lpfc: Move SCSI and NVME Stats to
+hardware queue structures") upstream, we allocated a cstat structure in
+lpfc_nvme_create_localport. When commit faf5a744f4f8 ("scsi: lpfc: avoid
+uninitialized variable warning") was backported, it was placed after the
+allocation so we leaked memory whenever this function was called and
+that conditional was true (so whenever CONFIG_NVME_FC is disabled).
+
+Move the IS_ENABLED if statement above the allocation since it is not
+needed when the condition is true.
+
+Reported-by: Pavel Machek <pavel@denx.de>
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Reviewed-by: James Smart <james.smart@broadcom.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/scsi/lpfc/lpfc_nvme.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/scsi/lpfc/lpfc_nvme.c
++++ b/drivers/scsi/lpfc/lpfc_nvme.c
+@@ -2477,14 +2477,14 @@ lpfc_nvme_create_localport(struct lpfc_v
+       lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
+       lpfc_nvme_template.max_hw_queues = phba->cfg_nvme_io_channel;
++      if (!IS_ENABLED(CONFIG_NVME_FC))
++              return ret;
++
+       cstat = kmalloc((sizeof(struct lpfc_nvme_ctrl_stat) *
+                       phba->cfg_nvme_io_channel), GFP_KERNEL);
+       if (!cstat)
+               return -ENOMEM;
+-      if (!IS_ENABLED(CONFIG_NVME_FC))
+-              return ret;
+-
+       /* localport is allocated from the stack, but the registration
+        * call allocates heap memory as well as the private area.
+        */
index 8430fccad54fe272dabb4cce129be828f9f33997..a5cd9b963d397fe091301f065fd16ac41cb2a5ab 100644 (file)
@@ -67,3 +67,4 @@ binder-fix-race-between-munmap-and-direct-reclaim.patch
 x86-ftrace-do-not-call-function-graph-from-dynamic-t.patch
 x86-ftrace-set-trampoline-pages-as-executable.patch
 x86-kprobes-set-instruction-page-as-executable.patch
+scsi-lpfc-fix-backport-of-faf5a744f4f8-scsi-lpfc-avoid-uninitialized-variable-warning.patch