public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	rmk+lkml@arm.linux.org.uk
Subject: Re: [PATCH] Convert serial_core oopses to BUG_ON
Date: Wed, 1 Mar 2006 20:00:49 +0100	[thread overview]
Message-ID: <20060301190049.GA1697@elf.ucw.cz> (raw)
In-Reply-To: <20060227162827.GC2389@ucw.cz>

Hi!

> With reference to these two bugs:
> 
> 	http://bugzilla.kernel.org/show_bug.cgi?id=5958
> 	http://bugzilla.kernel.org/show_bug.cgi?id=6131
> 
> it seems that folk are under the impression that serial_core is
> responsible for these bugs.  It isn't.
> 
> Calling serial functions to flush buffers, or try to send more data
> after the port has been closed or hung up is a bug in the code doing
> the calling, not in the serial_core driver.
> 
> Make this explicitly obvious by adding BUG_ON()'s.

They did not trigger for me, altrough my own traps do.

> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
> --- a/drivers/serial/serial_core.c
> +++ b/drivers/serial/serial_core.c
> @@ -521,6 +532,12 @@ static void uart_flush_buffer(struct tty
>  	struct uart_port *port = state->port;
>  	unsigned long flags;
>  
> +	/*
> +	 * This means you called this function _after_ the port was
> +	 * closed.  No cookie for you.
> +	 */
> +	BUG_ON(!state);
> +
>  	DPRINTK("uart_flush_buffer(%d) called\n", tty->index);
>  
>  	spin_lock_irqsave(&port->lock, flags);
> 

This is one I'm hitting. Actually I'm hitting my own check few lines
down:

        if (!state->info)
                printk(KERN_CRIT "no state->info\n");
        else uart_circ_clear(&state->info->xmit);
        spin_unlock_irqrestore(&port->lock, flags);
        tty_wakeup(tty);

... simply not doing uart_circ_clear() at all makes system
survive... so this could be made into WARN()...

								Pavel
-- 
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...

       reply	other threads:[~2006-03-01 20:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060227162827.GC2389@ucw.cz>
2006-03-01 19:00 ` Pavel Machek [this message]
     [not found] <5Kr1a-6MF-15@gated-at.bofh.it>
     [not found] ` <5KraE-6XP-15@gated-at.bofh.it>
     [not found]   ` <5KyFv-RL-15@gated-at.bofh.it>
2006-02-26 22:34     ` [PATCH] Convert serial_core oopses to BUG_ON Karol Kozimor
2006-02-26 22:41       ` Russell King
2006-02-26 10:05 Russell King
2006-02-26 10:14 ` Andrew Morton
2006-02-26 10:18   ` Nick Piggin
2006-02-26 18:17   ` Russell King
2006-02-26 20:00     ` Russell King
2006-02-27 14:13   ` Pavel Machek
2006-02-28 18:17     ` Andrew Morton
2006-02-28 22:01       ` Martin Michlmayr
2006-02-28 23:32         ` Andrew Morton
2006-03-01 17:10           ` Russell King
2006-03-01 19:47             ` Pavel Machek
2006-03-01 22:32               ` Andrew Morton

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=20060301190049.GA1697@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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