Skip to contentSkip to conversation

Convert serial_core oopses to BUG_ON

PATCH Pavel Machek 1 participant 1 message Mar 1, 2006 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi!

Quoted 5 lines

With reference to these two bugs:

	http://bugzilla.kernel.org/show_bug.cgi?id=5958
	http://bugzilla.kernel.org/show_bug.cgi?id=6131
Quoted 8 lines

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.

Quoted 7 lines
drivers/serial/serial_core.c +0 -0
@@ -521,6 +532,12 @@ static void uart_flush_buffer(struct tty
 	struct uart_port *port = state->port;
 	unsigned long flags;

drivers/serial/serial_core.c static void uart_flush_buffer(struct tty · line 543

Quoted 10 lines
drivers/serial/serial_core.c +6 -0
 
+	/*
+	 * 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

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...