Skip to contentSkip to conversation

kernel/irq/irqdomain.c: before use 'irq_data', need check it whether valid.

PATCH Applied Chen Gang 2 participants 3 messages May 14, 2013 – Jun 6, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 kernel/irq/irqdomain.c: before use 'irq_data', need check it whether valid.

Since irq_data may be NULL, if so, we WARN_ON(), and continue, 'hwirq' which related with 'irq_data' has to initialize later, or it will cause issue.

---
 kernel/irq/irqdomain.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/irq/irqdomain.c +2 -1
index af804b5..61abbfa 100644
@@ -400,11 +400,12 @@ static void irq_domain_disassociate_many(struct irq_domain *domain,
 	while (count--) {
 		int irq = irq_base + count;
 		struct irq_data *irq_data = irq_get_irq_data(irq);
-		irq_hw_number_t hwirq = irq_data->hwirq;
+		irq_hw_number_t hwirq;
 
 		if (WARN_ON(!irq_data || irq_data->domain != domain))
 			continue;
 
+		hwirq = irq_data->hwirq;
 		irq_set_status_flags(irq, IRQ_NOREQUEST);
 
 		/* remove chip and handler */
Signature · 1 line
1.7.7.6
Applied
#1 lore raw
Quoted 6 lines · Chen Gang

Since irq_data may be NULL, if so, we WARN_ON(), and continue, 'hwirq' which related with 'irq_data' has to initialize later, or it will cause issue.

Applied, thanks.

g.

Quoted 24 lines
---
 kernel/irq/irqdomain.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/irq/irqdomain.c +2 -1
index af804b5..61abbfa 100644
@@ -400,11 +400,12 @@ static void irq_domain_disassociate_many(struct irq_domain *domain,
 	while (count--) {
 		int irq = irq_base + count;
 		struct irq_data *irq_data = irq_get_irq_data(irq);
-		irq_hw_number_t hwirq = irq_data->hwirq;
+		irq_hw_number_t hwirq;
 
 		if (WARN_ON(!irq_data || irq_data->domain != domain))
 			continue;
 
+		hwirq = irq_data->hwirq;
 		irq_set_status_flags(irq, IRQ_NOREQUEST);
 
 		/* remove chip and handler */
Signature · 1 line
1.7.7.6
Signature · 2 lines
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.
author
#2 lore raw
Quoted 8 lines · Grant Likely
Quoted 6 lines · Chen Gang
Quoted 6 lines

Since irq_data may be NULL, if so, we WARN_ON(), and continue, 'hwirq' which related with 'irq_data' has to initialize later, or it will cause issue.

Applied, thanks.

Thank you too.

Signature · 3 lines
Chen Gang

Asianux Corporation