mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jamie Iles <jamie@jamieiles.com>
To: Jamie Iles <jamie@jamieiles.com>, Rob Herring <robherring2@gmail.com>
Cc: Rob Herring <robherring2@gmail.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Grant Likely <grant.likely@secretlab.ca>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH] irq: fix possible null-pointer deref irq_domain_to_irq
Date: Fri, 25 Nov 2011 15:35:53 +0000	[thread overview]
Message-ID: <20111125153553.GB8866@totoro> (raw)
In-Reply-To: <20111123122308.GA7382@totoro>

Hi Rob,

On Wed, Nov 23, 2011 at 12:23:08PM +0000, Jamie Iles wrote:
> On Thu, Nov 10, 2011 at 07:37:32AM -0600, Rob Herring wrote:
> > On 11/10/2011 05:14 AM, Jamie Iles wrote:
> > > On Thu, Nov 10, 2011 at 10:53:03AM +0000, Jamie Iles wrote:
> > >> 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>
> > > 
> > > Naturally git send-email doesn't know how to convert this into a CC, so 
> > > Rob is now CC'd!
> > > 
> > > Jamie
> > > 
> > >> 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.
> > 
> > Thanks. I didn't get around to it yesterday.
> > 
> > Acked-by: Rob Herring <rob.herring@calxeda.com>
> 
> I've just noticed in kernel/irq/irqdomain.c, that the kerneldoc for 
> irq_domain_add() says that a valid ops structure is required, so perhaps 
> this fix isn't right and we should just have an empty ops structure for 
> simple controllers...

I wonder if this might make more sense instead.  I'll post a proper 
patch if you think so.

Regards,

Jamie

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 200ce83..92c3484 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -143,11 +143,6 @@ int irq_domain_simple_dt_translate(struct irq_domain *d,
 	return 0;
 }
 
-struct irq_domain_ops irq_domain_simple_ops = {
-	.dt_translate = irq_domain_simple_dt_translate,
-};
-EXPORT_SYMBOL_GPL(irq_domain_simple_ops);
-
 /**
  * irq_domain_create_simple() - Set up a 'simple' translation range
  */
@@ -181,4 +176,11 @@ void irq_domain_generate_simple(const struct of_device_id *match,
 		pr_info("no node found\n");
 }
 EXPORT_SYMBOL_GPL(irq_domain_generate_simple);
+#else /* CONFIG_OF_IRQ */
+#define irq_domain_simple_dt_translate NULL
 #endif /* CONFIG_OF_IRQ */
+
+struct irq_domain_ops irq_domain_simple_ops = {
+	.dt_translate = irq_domain_simple_dt_translate,
+};
+EXPORT_SYMBOL_GPL(irq_domain_simple_ops);

  reply	other threads:[~2011-11-25 15:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 10:53 Jamie Iles
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 [this message]
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=20111125153553.GB8866@totoro \
    --to=jamie@jamieiles.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robherring2@gmail.com \
    --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®