diff mbox

[06/43] qla2xxx: Fix stale mem access for IRQ name

Message ID 20171220065644.21511-7-himanshu.madhani@cavium.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Madhani, Himanshu Dec. 20, 2017, 6:56 a.m. UTC
From: Quinn Tran <quinn.tran@cavium.com>

IRQ name pointer for INTx/MSI was pointing at stale stack frame.
cat /proc/interrupts will trigger stale mem access. Fix it by
creating dedicated space for IRQ name.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_def.h |  4 +++-
 drivers/scsi/qla2xxx/qla_isr.c | 10 +++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Bart Van Assche Dec. 20, 2017, 4:39 p.m. UTC | #1
On Tue, 2017-12-19 at 22:56 -0800, Himanshu Madhani wrote:
> From: Quinn Tran <quinn.tran@cavium.com>

> 

> IRQ name pointer for INTx/MSI was pointing at stale stack frame.

> cat /proc/interrupts will trigger stale mem access. Fix it by

> creating dedicated space for IRQ name.


What stale stack frame are you referring to? Just like in the first patch
of this series, I don't see any stack accesses being removed by this patch.
Is this patch useful? If not, can this patch be left out?

Thanks,

Bart.
Madhani, Himanshu Dec. 20, 2017, 8:41 p.m. UTC | #2
> On Dec 20, 2017, at 10:39 AM, Bart Van Assche <bart.vanassche@wdc.com> wrote:
> 
> On Tue, 2017-12-19 at 22:56 -0800, Himanshu Madhani wrote:
>> From: Quinn Tran <quinn.tran@cavium.com>
>> 
>> IRQ name pointer for INTx/MSI was pointing at stale stack frame.
>> cat /proc/interrupts will trigger stale mem access. Fix it by
>> creating dedicated space for IRQ name.
> 
> What stale stack frame are you referring to? Just like in the first patch
> of this series, I don't see any stack accesses being removed by this patch.
> Is this patch useful? If not, can this patch be left out?
> 
> Thanks,
> 
> Bart.

will drop this patch. 

Thanks,
- Himanshu
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index ca3ef9360ab9..5e509763a419 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3140,12 +3140,13 @@  struct scsi_qla_host;
 
 #define QLA83XX_RSPQ_MSIX_ENTRY_NUMBER 1 /* refer to qla83xx_msix_entries */
 
+#define IRQNAME_SZ 32
 struct qla_msix_entry {
 	int have_irq;
 	int in_use;
 	uint32_t vector;
 	uint16_t entry;
-	char name[30];
+	char name[IRQNAME_SZ];
 	void *handle;
 	int cpuid;
 };
@@ -4025,6 +4026,7 @@  struct qla_hw_data {
 	uint16_t        zio_timer;
 
 	struct qla_msix_entry *msix_entries;
+	u8 irqname[IRQNAME_SZ];	/* msi/intx */
 
 	struct list_head        vp_list;        /* list of VP */
 	unsigned long   vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) /
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index a265c2d8c9cc..33865e0bb29f 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3607,9 +3607,17 @@  qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
 	if (!ha->flags.msi_enabled && IS_QLA82XX(ha))
 		return QLA_FUNCTION_FAILED;
 
+	memset(ha->irqname, 0, IRQNAME_SZ);
+	if (ha->flags.msi_enabled)
+		scnprintf(ha->irqname, IRQNAME_SZ,
+		    "qla2xxx%lu_msi", vha->host_no);
+	else
+		scnprintf(ha->irqname, IRQNAME_SZ,
+		    "qla2xxx%lu_intx", vha->host_no);
 	ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler,
 	    ha->flags.msi_enabled ? 0 : IRQF_SHARED,
-	    QLA2XXX_DRIVER_NAME, rsp);
+	    ha->irqname, rsp);
+
 	if (ret) {
 		ql_log(ql_log_warn, vha, 0x003a,
 		    "Failed to reserve interrupt %d already in use.\n",