public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq:Dereference desc after null pointer check
@ 2018-07-16 22:27 RAGHU Halharvi
  2018-07-16 23:03 ` RAGHU Halharvi
  2018-07-17 12:25 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: RAGHU Halharvi @ 2018-07-16 22:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: RAGHU Halharvi, tglx

* 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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index facfecfc543c..064d98e5ae32 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1557,7 +1557,7 @@ 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;
 
@@ -1566,6 +1566,7 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id)
 	if (!desc)
 		return NULL;
 
+	irq = desc->irq_data.irq;
 	mutex_lock(&desc->request_mutex);
 	chip_bus_lock(desc);
 	raw_spin_lock_irqsave(&desc->lock, flags);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-17 13:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16 22:27 [PATCH] genirq:Dereference desc after null pointer check RAGHU Halharvi
2018-07-16 23:03 ` RAGHU Halharvi
2018-07-17  7:51   ` Thomas Gleixner
2018-07-17 12:25 ` Dan Carpenter
2018-07-17 12:38   ` RAGHU H

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox