mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq: Avoid NULL OOPS in irq handling
@ 2013-09-28  2:11 Huacai Chen
  2013-10-29 13:07 ` Thomas Gleixner
  0 siblings, 1 reply; 5+ messages in thread
From: Huacai Chen @ 2013-09-28  2:11 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Huacai Chen

Some devices (e.g. serial port) setup irq handler at dev open and free
it at dev close. So, sometimes there is no irqaction for a specific
irq. But some buggy devices may send irqs at any time. This patch avoid
the NULL OOPS when irqaction isn't registered.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 kernel/irq/handle.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 131ca17..1c78e69 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -135,6 +135,9 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
 	irqreturn_t retval = IRQ_NONE;
 	unsigned int flags = 0, irq = desc->irq_data.irq;
 
+	if (!action)
+		goto out;
+
 	do {
 		irqreturn_t res;
 
@@ -174,6 +177,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
 
 	add_interrupt_randomness(irq, flags);
 
+out:
 	if (!noirqdebug)
 		note_interrupt(irq, desc, retval);
 	return retval;
-- 
1.7.7.3


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

* Re: [PATCH] genirq: Avoid NULL OOPS in irq handling
  2013-09-28  2:11 [PATCH] genirq: Avoid NULL OOPS in irq handling Huacai Chen
@ 2013-10-29 13:07 ` Thomas Gleixner
  2013-10-30  9:24   ` "陈华才"
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2013-10-29 13:07 UTC (permalink / raw)
  To: Huacai Chen; +Cc: linux-kernel

On Sat, 28 Sep 2013, Huacai Chen wrote:

> Some devices (e.g. serial port) setup irq handler at dev open and free
> it at dev close. So, sometimes there is no irqaction for a specific
> irq. But some buggy devices may send irqs at any time. This patch avoid
> the NULL OOPS when irqaction isn't registered.

All callers except the real per cpu interrupts are checking whether
there is a valid action before calling. And serial ports are not
routed to real per cpu interrupts. Can you provide more detailed
information about the problem you are trying to solve please?

Thanks,

	tglx

> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
>  kernel/irq/handle.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
> index 131ca17..1c78e69 100644
> --- a/kernel/irq/handle.c
> +++ b/kernel/irq/handle.c
> @@ -135,6 +135,9 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
>  	irqreturn_t retval = IRQ_NONE;
>  	unsigned int flags = 0, irq = desc->irq_data.irq;
>  
> +	if (!action)
> +		goto out;
> +
>  	do {
>  		irqreturn_t res;
>  
> @@ -174,6 +177,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
>  
>  	add_interrupt_randomness(irq, flags);
>  
> +out:
>  	if (!noirqdebug)
>  		note_interrupt(irq, desc, retval);
>  	return retval;
> -- 
> 1.7.7.3
> 
> 

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

* Re: [PATCH] genirq: Avoid NULL OOPS in irq handling
  2013-10-29 13:07 ` Thomas Gleixner
@ 2013-10-30  9:24   ` "陈华才"
  2013-10-30 10:06     ` Thomas Gleixner
  0 siblings, 1 reply; 5+ messages in thread
From: "陈华才" @ 2013-10-30  9:24 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel

I use a Loongson-3(MIPS-series CPU) machine, there is a serial port
integrated in the CPU (but it iss buggy), and it use handle_percpu_irq()
as the irq handler. Maybe I should move the checking into
handle_percpu_irq()?

Huacai

> On Sat, 28 Sep 2013, Huacai Chen wrote:
>
>> Some devices (e.g. serial port) setup irq handler at dev open and free
>> it at dev close. So, sometimes there is no irqaction for a specific
>> irq. But some buggy devices may send irqs at any time. This patch avoid
>> the NULL OOPS when irqaction isn't registered.
>
> All callers except the real per cpu interrupts are checking whether
> there is a valid action before calling. And serial ports are not
> routed to real per cpu interrupts. Can you provide more detailed
> information about the problem you are trying to solve please?
>
> Thanks,
>
> 	tglx
>
>> Signed-off-by: Huacai Chen <chenhc@lemote.com>
>> ---
>>  kernel/irq/handle.c |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
>> index 131ca17..1c78e69 100644
>> --- a/kernel/irq/handle.c
>> +++ b/kernel/irq/handle.c
>> @@ -135,6 +135,9 @@ handle_irq_event_percpu(struct irq_desc *desc,
>> struct irqaction *action)
>>  	irqreturn_t retval = IRQ_NONE;
>>  	unsigned int flags = 0, irq = desc->irq_data.irq;
>>
>> +	if (!action)
>> +		goto out;
>> +
>>  	do {
>>  		irqreturn_t res;
>>
>> @@ -174,6 +177,7 @@ handle_irq_event_percpu(struct irq_desc *desc,
>> struct irqaction *action)
>>
>>  	add_interrupt_randomness(irq, flags);
>>
>> +out:
>>  	if (!noirqdebug)
>>  		note_interrupt(irq, desc, retval);
>>  	return retval;
>> --
>> 1.7.7.3
>>
>>
>



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

* Re: [PATCH] genirq: Avoid NULL OOPS in irq handling
  2013-10-30  9:24   ` "陈华才"
@ 2013-10-30 10:06     ` Thomas Gleixner
  2013-10-30 13:02       ` "陈华才"
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2013-10-30 10:06 UTC (permalink / raw)
  To: "陈华才"; +Cc: linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 336 bytes --]

On Wed, 30 Oct 2013, "陈华才" wrote:

> I use a Loongson-3(MIPS-series CPU) machine, there is a serial port
> integrated in the CPU (but it iss buggy), and it use handle_percpu_irq()
> as the irq handler. Maybe I should move the checking into
> handle_percpu_irq()?

Why is a device interrupt using handle_percpu_irq()?
 
Thanks,

	tglx

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

* Re: [PATCH] genirq: Avoid NULL OOPS in irq handling
  2013-10-30 10:06     ` Thomas Gleixner
@ 2013-10-30 13:02       ` "陈华才"
  0 siblings, 0 replies; 5+ messages in thread
From: "陈华才" @ 2013-10-30 13:02 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel

> On Wed, 30 Oct 2013, "陈华才" wrote:
>
>> I use a Loongson-3(MIPS-series CPU) machine, there is a serial port
>> integrated in the CPU (but it iss buggy), and it use handle_percpu_irq()
>> as the irq handler. Maybe I should move the checking into
>> handle_percpu_irq()?
>
> Why is a device interrupt using handle_percpu_irq()?
Seems that IRQs directly deliverd to MIPS CPU (those without interrupt
controller) are all handled by handle_percpu_irq().... I will try to
overwrite the handler in arch-specific code and keep the code in kernel/
irq as is. Thanks.
>
> Thanks,
>
> 	tglx



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

end of thread, other threads:[~2013-10-30 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-28  2:11 [PATCH] genirq: Avoid NULL OOPS in irq handling Huacai Chen
2013-10-29 13:07 ` Thomas Gleixner
2013-10-30  9:24   ` "陈华才"
2013-10-30 10:06     ` Thomas Gleixner
2013-10-30 13:02       ` "陈华才"

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®