Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1437521 > unrolled thread

[PATCH] qla2xxx: setup data needed in ISR before setting up the ISR

Started byJohannes Thumshirn <jthumshirn@suse.de>
First post2016-07-06 10:00 +0200
Last post2016-07-06 11:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] qla2xxx: setup data needed in ISR before setting up the ISR Johannes Thumshirn <jthumshirn@suse.de> - 2016-07-06 10:00 +0200
    Re: [PATCH] qla2xxx: setup data needed in ISR before setting up the  ISR Hannes Reinecke <hare@suse.de> - 2016-07-06 11:50 +0200

#1437521 — [PATCH] qla2xxx: setup data needed in ISR before setting up the ISR

FromJohannes Thumshirn <jthumshirn@suse.de>
Date2016-07-06 10:00 +0200
Subject[PATCH] qla2xxx: setup data needed in ISR before setting up the ISR
Message-ID<rRPUu-6nj-13@gated-at.bofh.it>
qla2xxx first calls request_irq() and then does the setup of the queue
entry data needed in the interrupt handlers in when using MSI-X. This
could lead to a NULL pointer dereference when an IRQ fires between the
request_irq() call and the assignment of the qentry data structure to the
rsp->msix field. A possible case for such a race would be in the kdump
case when the HBA's IRQs are still enabled but the driver is undergoing
a new initialisation and thus is not aware of already activated IRQs in
the HBA.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/scsi/qla2xxx/qla_isr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 5649c20..20743a3 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3086,6 +3086,8 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
 	/* Enable MSI-X vectors for the base queue */
 	for (i = 0; i < 2; i++) {
 		qentry = &ha->msix_entries[i];
+		qentry->rsp = rsp;
+		rsp->msix = qentry;
 		if (IS_P3P_TYPE(ha))
 			ret = request_irq(qentry->vector,
 				qla82xx_msix_entries[i].handler,
@@ -3097,8 +3099,6 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
 		if (ret)
 			goto msix_register_fail;
 		qentry->have_irq = 1;
-		qentry->rsp = rsp;
-		rsp->msix = qentry;
 
 		/* Register for CPU affinity notification. */
 		irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify);
@@ -3119,12 +3119,12 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
 	 */
 	if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) {
 		qentry = &ha->msix_entries[ATIO_VECTOR];
+		qentry->rsp = rsp;
+		rsp->msix = qentry;
 		ret = request_irq(qentry->vector,
 			qla83xx_msix_entries[ATIO_VECTOR].handler,
 			0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp);
 		qentry->have_irq = 1;
-		qentry->rsp = rsp;
-		rsp->msix = qentry;
 	}
 
 msix_register_fail:
-- 
1.8.5.6

[toc] | [next] | [standalone]


#1437592 — Re: [PATCH] qla2xxx: setup data needed in ISR before setting up the ISR

FromHannes Reinecke <hare@suse.de>
Date2016-07-06 11:50 +0200
SubjectRe: [PATCH] qla2xxx: setup data needed in ISR before setting up the ISR
Message-ID<rRRCW-7w1-7@gated-at.bofh.it>
In reply to#1437521
On 07/06/2016 09:51 AM, Johannes Thumshirn wrote:
> qla2xxx first calls request_irq() and then does the setup of the queue
> entry data needed in the interrupt handlers in when using MSI-X. This
> could lead to a NULL pointer dereference when an IRQ fires between the
> request_irq() call and the assignment of the qentry data structure to the
> rsp->msix field. A possible case for such a race would be in the kdump
> case when the HBA's IRQs are still enabled but the driver is undergoing
> a new initialisation and thus is not aware of already activated IRQs in
> the HBA.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  drivers/scsi/qla2xxx/qla_isr.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web