lkml.org 
[lkml]   [2011]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] irq: fix possible null-pointer deref irq_domain_to_irq
Date
It is optional for an irqdomain to have a to_irq() method, and for
simple domains they often don't require any operations at all - just
hwirq to Linux irq translation. Check we have valid ops before
dereferencing them.

Patch originally by Rob Herring.

Suggested-by: Rob Herring <robherring2@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---

Rob, I can't see that you've already posted this but I didn't want to
hold Marc's GIC patches up.

include/linux/irqdomain.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 99834e58..78a1e66 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -74,7 +74,7 @@ struct irq_domain {
static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
unsigned long hwirq)
{
- if (d->ops->to_irq)
+ if (d->ops && d->ops->to_irq)
return d->ops->to_irq(d, hwirq);
if (WARN_ON(hwirq < d->hwirq_base))
return 0;
--
1.7.4.1


\
 
 \ /
  Last update: 2011-11-10 11:55    [W:0.008 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site