[PATCH] irq: Fix possible null pointer dereference on domains with no ops

From: Mark Brown
Date: Wed Nov 23 2011 - 07:13:33 EST


It is optional for irqdomains to have operations so we need to check for
their presence before dereferencing them when looking for dt_translate().

Signed-off-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
kernel/irq/irqdomain.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 200ce83..b22a641 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -89,7 +89,7 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
/* Find a domain which can translate the irq spec */
mutex_lock(&irq_domain_mutex);
list_for_each_entry(domain, &irq_domain_list, list) {
- if (!domain->ops->dt_translate)
+ if (!domain->ops || !domain->ops->dt_translate)
continue;
rc = domain->ops->dt_translate(domain, controller,
intspec, intsize, &hwirq, &type);
--
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/