netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: jeff@garzik.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] BUG_ON() bad input to request_irq
Date: Wed, 23 Jan 2008 14:04:14 -0800	[thread overview]
Message-ID: <20080123140414.e1ff2263.akpm@linux-foundation.org> (raw)
In-Reply-To: <200801171759.59029.rusty@rustcorp.com.au>

> On Thu, 17 Jan 2008 17:59:58 +1100 Rusty Russell <rusty@rustcorp.com.au> wrote:
> Is there any reason why these bugs should be treated gently?  The
> caller might not want to check NR_IRQS and IRQ_NOREQUEST cases, but
> a NULL handler or NULL dev_id w/ shared are coding bugs.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> ---
>  kernel/irq/manage.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff -r c2eb8ef5a0be kernel/irq/manage.c
> --- a/kernel/irq/manage.c	Thu Jan 17 15:48:03 2008 +1100
> +++ b/kernel/irq/manage.c	Thu Jan 17 15:49:33 2008 +1100
> @@ -532,13 +532,12 @@ int request_irq(unsigned int irq, irq_ha
>  	 * which interrupt is which (messes up the interrupt freeing
>  	 * logic etc).
>  	 */
> -	if ((irqflags & IRQF_SHARED) && !dev_id)
> -		return -EINVAL;
> +	BUG_ON((irqflags & IRQF_SHARED) && !dev_id);
> +	BUG_ON(!handler);
> +
>  	if (irq >= NR_IRQS)
>  		return -EINVAL;
>  	if (irq_desc[irq].status & IRQ_NOREQUEST)
> -		return -EINVAL;
> -	if (!handler)
>  		return -EINVAL;
>  
>  	action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);

If no driver is passing in args which will trigger this BUG, we presumably
don't need the patch.

If some driver _is_ passing in ags which will trigger these BUGs then it is
presumably working OK anyway.  Taking a working system and making it go BUG
is likely to upset people.

IOW: WARN_ON, please.

  reply	other threads:[~2008-01-23 22:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17  6:57 [PATCH] request_irq() always returns -EINVAL with a NULL handler Rusty Russell
2008-01-17  6:59 ` [PATCH] BUG_ON() bad input to request_irq Rusty Russell
2008-01-23 22:04   ` Andrew Morton [this message]
2008-01-23 22:15     ` Rusty Russell
2008-01-17 16:22 ` [PATCH] request_irq() always returns -EINVAL with a NULL handler Stephen Hemminger
2008-02-03  6:15 ` Andrew Morton
2008-02-04  5:55   ` Rusty Russell

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=20080123140414.e1ff2263.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).