mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* linux/kernel/irq/chip.c IRQ disable, shutdown bug
@ 2008-02-15 14:10 Hennerich, Michael
  2008-02-23  8:07 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Hennerich, Michael @ 2008-02-15 14:10 UTC (permalink / raw)
  To: linux-kernel

free_irq() does not disable/mask the irq, in case disable or shutdown in struct irq_chip is left uninitilazied.

/**
 * struct irq_chip - hardware interrupt chip descriptor
 *
 * @name:		name for /proc/interrupts
 * @startup:		start up the interrupt (defaults to ->enable if NULL)
 * @shutdown:		shut down the interrupt (defaults to ->disable if NULL)
 * @enable:		enable the interrupt (defaults to chip->unmask if NULL)
 * @disable:		disable the interrupt (defaults to chip->mask if NULL)


According to linux/irq.h struct irq_chip information,
chip->disable should default to chip->mask if NULL.
However irq_chip_set_defaults(struct irq_chip *chip) will set it to default_disable a empty function.


Looking through various architectures, it's pretty common that disable and shutdown is NULL.
So this bug affects many architectures.

This patch fixes the issue.

Best regards,
Michael

Index: irq/chip.c
===================================================================
--- irq/chip.c  (revision 4276)
+++ irq/chip.c  (working copy)
@@ -233,6 +233,10 @@
  */
 static void default_disable(unsigned int irq)
 {
+       struct irq_desc *desc = irq_desc + irq;
+
+       desc->chip->mask(irq);
+       desc->status |= IRQ_MASKED;
 }

 /*


------------------------------------------------------------------
********* Analog Devices GmbH         michael.hennerich@analog.com
**  *****                                      Systems Engineering
**     ** Wilhelm-Wagenfeld-Strasse 6       
**  ***** D-80807 Munich                      
********* Germany                          
Registergericht München HRB 40368,  Geschäftsführer:  Thomas Wessel,  Vincent Roche,  Joseph E. McDonough

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

* Re: linux/kernel/irq/chip.c IRQ disable, shutdown bug
  2008-02-15 14:10 linux/kernel/irq/chip.c IRQ disable, shutdown bug Hennerich, Michael
@ 2008-02-23  8:07 ` Andrew Morton
  2008-02-23 10:13   ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2008-02-23  8:07 UTC (permalink / raw)
  To: Hennerich, Michael; +Cc: linux-kernel, Ingo Molnar, Thomas Gleixner

On Fri, 15 Feb 2008 14:10:18 -0000 "Hennerich, Michael" <Michael.Hennerich@analog.com> wrote:

> free_irq() does not disable/mask the irq, in case disable or shutdown in struct irq_chip is left uninitilazied.
> 
> /**
>  * struct irq_chip - hardware interrupt chip descriptor
>  *
>  * @name:		name for /proc/interrupts
>  * @startup:		start up the interrupt (defaults to ->enable if NULL)
>  * @shutdown:		shut down the interrupt (defaults to ->disable if NULL)
>  * @enable:		enable the interrupt (defaults to chip->unmask if NULL)
>  * @disable:		disable the interrupt (defaults to chip->mask if NULL)
> 
> 
> According to linux/irq.h struct irq_chip information,
> chip->disable should default to chip->mask if NULL.
> However irq_chip_set_defaults(struct irq_chip *chip) will set it to default_disable a empty function.
> 
> 
> Looking through various architectures, it's pretty common that disable and shutdown is NULL.
> So this bug affects many architectures.
> 
> This patch fixes the issue.
> 

Please send a Signed-off-by: for this work, as per
Documentation/SubmittingPatches, thanks.


> Index: irq/chip.c
> ===================================================================
> --- irq/chip.c  (revision 4276)
> +++ irq/chip.c  (working copy)

Please prepare future patches in `patch -p1' form.  This should have been

> --- a/kernel/irq/chip.c
> +++ a/kernel/irq/chip.c


> @@ -233,6 +233,10 @@
>   */
>  static void default_disable(unsigned int irq)
>  {
> +       struct irq_desc *desc = irq_desc + irq;
> +
> +       desc->chip->mask(irq);
> +       desc->status |= IRQ_MASKED;
>  }
> 
>  /*

Ingo, Thomas: ack?

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

* Re: linux/kernel/irq/chip.c IRQ disable, shutdown bug
  2008-02-23  8:07 ` Andrew Morton
@ 2008-02-23 10:13   ` Ingo Molnar
  2008-02-23 17:51     ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2008-02-23 10:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Hennerich, Michael, linux-kernel, Thomas Gleixner


* Andrew Morton <akpm@linux-foundation.org> wrote:

> > +       desc->chip->mask(irq);
> > +       desc->status |= IRQ_MASKED;
> >  }
> > 
> >  /*
> 
> Ingo, Thomas: ack?

we've already queued it in up the genirq tree. (in a slightly different 
form)

	Ingo

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

* Re: linux/kernel/irq/chip.c IRQ disable, shutdown bug
  2008-02-23 10:13   ` Ingo Molnar
@ 2008-02-23 17:51     ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2008-02-23 17:51 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andrew Morton, Hennerich, Michael, linux-kernel

On Sat, 23 Feb 2008, Ingo Molnar wrote:
 
> * Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > > +       desc->chip->mask(irq);
> > > +       desc->status |= IRQ_MASKED;
> > >  }
> > > 
> > >  /*
> > 
> > Ingo, Thomas: ack?
> 
> we've already queued it in up the genirq tree. (in a slightly different 
> form)

Already mainline: 89d694b9dbe769ca1004e01db0ca43964806a611

Thanks,

	tglx

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

end of thread, other threads:[~2008-02-23 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 14:10 linux/kernel/irq/chip.c IRQ disable, shutdown bug Hennerich, Michael
2008-02-23  8:07 ` Andrew Morton
2008-02-23 10:13   ` Ingo Molnar
2008-02-23 17:51     ` Thomas Gleixner

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®