mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jamie Iles <jamie@jamieiles.com>
To: linux-kernel@vger.kernel.org
Cc: Jamie Iles <jamie@jamieiles.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Grant Likely <grant.likely@secretlab.ca>
Subject: [PATCH] irq: fix possible null-pointer deref irq_domain_to_irq
Date: Thu, 10 Nov 2011 10:53:03 +0000	[thread overview]
Message-ID: <1320922383-15312-1-git-send-email-jamie@jamieiles.com> (raw)

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


             reply	other threads:[~2011-11-10 10:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 10:53 Jamie Iles [this message]
2011-11-10 11:14 ` Jamie Iles
2011-11-10 13:37   ` Rob Herring
2011-11-23 12:23     ` Jamie Iles
2011-11-25 15:35       ` Jamie Iles
2011-11-27 15:11         ` Rob Herring
2011-11-27 15:24           ` Jamie Iles
2011-11-16 11:34 ` Jamie Iles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320922383-15312-1-git-send-email-jamie@jamieiles.com \
    --to=jamie@jamieiles.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®