From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>,
Dick Kennedy <dick.kennedy@broadcom.com>,
James Smart <james.smart@broadcom.com>
Subject: [PATCH v2 11/17] lpfc: Fix System panic after loading the driver
Date: Thu, 1 Jun 2017 21:07:05 -0700 [thread overview]
Message-ID: <20170602040711.21046-12-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170602040711.21046-1-jsmart2021@gmail.com>
System panic with general protection fault during driver load
The driver uses a static array sli4_hba.handler_name
to store the irq handler names. If the io_channel_irqs
exceeds the pre-allocated size (32+1), then the driver
will overwrite other fields of sli4_hba.
Fix: Dynamically allocate handler_name.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
drivers/scsi/lpfc/lpfc_init.c | 11 ++++++-----
drivers/scsi/lpfc/lpfc_sli4.h | 4 ++--
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 3064f0768033..a825806036c3 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -9665,6 +9665,7 @@ static int
lpfc_sli4_enable_msix(struct lpfc_hba *phba)
{
int vectors, rc, index;
+ char *name;
/* Set up MSI-X multi-message vectors */
vectors = phba->io_channel_irqs;
@@ -9683,9 +9684,9 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
/* Assign MSI-X vectors to interrupt handlers */
for (index = 0; index < vectors; index++) {
- memset(&phba->sli4_hba.handler_name[index], 0, 16);
- snprintf((char *)&phba->sli4_hba.handler_name[index],
- LPFC_SLI4_HANDLER_NAME_SZ,
+ name = phba->sli4_hba.hba_eq_hdl[index].handler_name;
+ memset(name, 0, LPFC_SLI4_HANDLER_NAME_SZ);
+ snprintf(name, LPFC_SLI4_HANDLER_NAME_SZ,
LPFC_DRIVER_HANDLER_NAME"%d", index);
phba->sli4_hba.hba_eq_hdl[index].idx = index;
@@ -9694,12 +9695,12 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
if (phba->cfg_fof && (index == (vectors - 1)))
rc = request_irq(pci_irq_vector(phba->pcidev, index),
&lpfc_sli4_fof_intr_handler, 0,
- (char *)&phba->sli4_hba.handler_name[index],
+ name,
&phba->sli4_hba.hba_eq_hdl[index]);
else
rc = request_irq(pci_irq_vector(phba->pcidev, index),
&lpfc_sli4_hba_intr_handler, 0,
- (char *)&phba->sli4_hba.handler_name[index],
+ name,
&phba->sli4_hba.hba_eq_hdl[index]);
if (rc) {
lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index cf863db27700..28b75e08e044 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -407,8 +407,10 @@ struct lpfc_max_cfg_param {
struct lpfc_hba;
/* SLI4 HBA multi-fcp queue handler struct */
+#define LPFC_SLI4_HANDLER_NAME_SZ 16
struct lpfc_hba_eq_hdl {
uint32_t idx;
+ char handler_name[LPFC_SLI4_HANDLER_NAME_SZ];
struct lpfc_hba *phba;
atomic_t hba_eq_in_use;
struct cpumask *cpumask;
@@ -480,7 +482,6 @@ struct lpfc_sli4_lnk_info {
#define LPFC_SLI4_HANDLER_CNT (LPFC_HBA_IO_CHAN_MAX+ \
LPFC_FOF_IO_CHAN_NUM)
-#define LPFC_SLI4_HANDLER_NAME_SZ 16
/* Used for IRQ vector to CPU mapping */
struct lpfc_vector_map_info {
@@ -548,7 +549,6 @@ struct lpfc_sli4_hba {
uint32_t ue_to_rp;
struct lpfc_register sli_intf;
struct lpfc_pc_sli4_params pc_sli4_params;
- uint8_t handler_name[LPFC_SLI4_HANDLER_CNT][LPFC_SLI4_HANDLER_NAME_SZ];
struct lpfc_hba_eq_hdl *hba_eq_hdl; /* HBA per-WQ handle */
/* Pointers to the constructed SLI4 queues */
--
2.11.0
next prev parent reply other threads:[~2017-06-02 4:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 4:06 [PATCH v2 00/17] lpfc updates for 11.4.0.0 James Smart
2017-06-02 4:06 ` [PATCH v2 01/17] lpfc: Add nvme initiator devloss support James Smart
2017-06-02 4:06 ` [PATCH v2 02/17] lpfc: Fix transition nvme-i rport handling to nport only James Smart
2017-06-02 4:06 ` [PATCH v2 03/17] lpfc: Fix nvme port role handling in sysfs and debugfs handlers James Smart
2017-06-02 4:06 ` [PATCH v2 04/17] lpfc: Add changes to assist in NVMET debugging James Smart
2017-06-02 4:06 ` [PATCH v2 05/17] lpfc: Fix Lun Priority level shown as NA James Smart
2017-06-02 4:07 ` [PATCH v2 06/17] lpfc: Fix nvmet node ref count handling James Smart
2017-06-02 4:07 ` [PATCH v2 07/17] lpfc: Fix Port going offline after multiple resets James Smart
2017-06-02 4:07 ` [PATCH v2 08/17] lpfc: Fix counters so outstandng NVME IO count is accurate James Smart
2017-06-02 4:07 ` [PATCH v2 09/17] lpfc: Fix return value of board_mode store routine in case of online failure James Smart
2017-06-02 4:07 ` [PATCH v2 10/17] lpfc: Fix crash on powering off BFS VM with passthrough device James Smart
2017-06-02 4:07 ` James Smart [this message]
2017-06-02 4:07 ` [PATCH v2 12/17] lpfc: Null pointer dereference when log_verbose is set to 0xffffffff James Smart
2017-06-02 4:07 ` [PATCH v2 13/17] lpfc: Fix PRLI retry handling when target rejects it James Smart
2017-06-02 4:07 ` [PATCH v2 14/17] lpfc: Fix vports not logging into target James Smart
2017-06-02 4:07 ` [PATCH v2 15/17] lpfc: Fix defects reported by Coverity Scan James Smart
2017-06-02 4:07 ` [PATCH v2 16/17] lpfc: Add auto EQ delay logic James Smart
2017-06-02 4:07 ` [PATCH v2 17/17] lpfc: update to revision to 11.4.0.0 James Smart
2017-06-06 1:13 ` [PATCH v2 00/17] lpfc updates for 11.4.0.0 Martin K. Petersen
2017-06-07 4:20 ` James Smart
2017-06-13 3:04 ` Martin K. Petersen
2017-06-15 16:59 ` James Smart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170602040711.21046-12-jsmart2021@gmail.com \
--to=jsmart2021@gmail.com \
--cc=dick.kennedy@broadcom.com \
--cc=james.smart@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox