All of lore.kernel.org
 help / color / mirror / Atom feed
From: RAGHU Halharvi <raghuhack78@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: RAGHU Halharvi <raghuhack78@gmail.com>, tglx@linutronix.de
Subject: [PATCH] genirq:Dereference desc after null pointer check
Date: Tue, 17 Jul 2018 04:33:09 +0530	[thread overview]
Message-ID: <20180716230309.23937-1-raghuhack78@gmail.com> (raw)
In-Reply-To: <20180716222725.14896-1-raghuhack78@gmail.com>

* Remove unchecked dereferencing of *desc & assigning it local irq
	variable
* Move the assignement after proper check of *desc for NULL pointer.

Signed-off-by: RAGHU Halharvi <raghuhack78@gmail.com>
---
 kernel/irq/manage.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index facfecfc543c..33c77eb4fdb6 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1557,15 +1557,16 @@ EXPORT_SYMBOL_GPL(setup_irq);
  */
 static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id)
 {
-	unsigned irq = desc->irq_data.irq;
+	unsigned int irq;
 	struct irqaction *action, **action_ptr;
 	unsigned long flags;
 
-	WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq);
 
 	if (!desc)
 		return NULL;
 
+	irq = desc->irq_data.irq;
+	WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq);
 	mutex_lock(&desc->request_mutex);
 	chip_bus_lock(desc);
 	raw_spin_lock_irqsave(&desc->lock, flags);
-- 
2.17.1


  reply	other threads:[~2018-07-17  7:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 22:27 [PATCH] genirq:Dereference desc after null pointer check RAGHU Halharvi
2018-07-16 23:03 ` RAGHU Halharvi [this message]
2018-07-17  7:51   ` Thomas Gleixner
2018-07-17 12:25 ` Dan Carpenter
2018-07-17 12:38   ` RAGHU H

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=20180716230309.23937-1-raghuhack78@gmail.com \
    --to=raghuhack78@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.