public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* lockup when accessing serial port (and fix)
@ 2005-02-07 20:30 Stas Sergeev
  2005-02-21 15:03 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Stas Sergeev @ 2005-02-07 20:30 UTC (permalink / raw)
  To: Linux kernel

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Hello.

When I am trying to use the serial
port, I am getting the machine lockup.
This started to happen sometime in a
2.6.9 era I think, and is not fixed
in the latest 2.6.11 pre's.
The bug looks trivial, unless I am
missing something. "port.lock" is
acquired in serial8250_interrupt()
and later in uart_start(), and that's
where the system is dead.
The calltrace is as follows:

serial8250_interrupt->!spin_lock(port.lock)!->serial8250_handle_port->
receive_chars->tty_flip_buffer_push->flush_to_ldisc->n_tty_receive_buf->
uart_flush_chars->uart_start->!spin_lock(port.lock)!->deadlock:(

Attached is a quick works-for-me fix
that just releases the lock at one
point. Can someone please have a look
into it and see if the other ser drivers
needs the same (or another) treatment?
Well, I can understand that the legacy
ser ports may not be too popular these
days, but then it is a local DoS, so it
may still be worth having a look.
I'll very much appreciate if the serial
port is to work again. I am still using
it, really! :)


[-- Attachment #2: ser_lock.diff --]
[-- Type: text/x-patch, Size: 841 bytes --]

--- linux-2.6.10/drivers/serial/au1x00_uart.c	2004-12-31 10:16:15.000000000 +0300
+++ linux-2.6.10/drivers/serial/au1x00_uart.c	2005-02-07 15:42:42.000000000 +0300
@@ -320,7 +320,9 @@
 	ignore_char:
 		*status = serial_inp(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
+	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(tty);
+	spin_lock(&up->port.lock);
 }
 
 static _INLINE_ void transmit_chars(struct uart_8250_port *up)
--- linux-2.6.10/drivers/serial/8250.c	2005-02-07 13:47:57.000000000 +0300
+++ linux-2.6.10/drivers/serial/8250.c	2005-02-07 15:43:47.000000000 +0300
@@ -1059,7 +1059,9 @@
 	ignore_char:
 		lsr = serial_inp(up, UART_LSR);
 	} while ((lsr & UART_LSR_DR) && (max_count-- > 0));
+	spin_unlock(&up->port.lock);
 	tty_flip_buffer_push(tty);
+	spin_lock(&up->port.lock);
 	*status = lsr;
 }
 

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

* Re: lockup when accessing serial port (and fix)
  2005-02-07 20:30 lockup when accessing serial port (and fix) Stas Sergeev
@ 2005-02-21 15:03 ` Alan Cox
  2005-02-21 17:12   ` Russell King
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2005-02-21 15:03 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: Linux Kernel Mailing List

On Llu, 2005-02-07 at 20:30, Stas Sergeev wrote:
> Hello.
> 
> When I am trying to use the serial
> port, I am getting the machine lockup.
> This started to happen sometime in a
> 2.6.9 era I think, and is not fixed
> in the latest 2.6.11 pre's.

Known bug, just nobody has bothered to fix it. Please send the fix to
Linus so it gets into 2.6.11


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

* Re: lockup when accessing serial port (and fix)
  2005-02-21 15:03 ` Alan Cox
@ 2005-02-21 17:12   ` Russell King
  2005-02-21 17:41     ` Stas Sergeev
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2005-02-21 17:12 UTC (permalink / raw)
  To: Alan Cox; +Cc: Stas Sergeev, Linux Kernel Mailing List

On Mon, Feb 21, 2005 at 03:03:32PM +0000, Alan Cox wrote:
> Known bug, just nobody has bothered to fix it. Please send the fix to
> Linus so it gets into 2.6.11

Alan,

The fix was submitted to and accepted by Linus on Feb 8th.  Therefore,
there's nothing to "bother" with.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* Re: lockup when accessing serial port (and fix)
  2005-02-21 17:12   ` Russell King
@ 2005-02-21 17:41     ` Stas Sergeev
  0 siblings, 0 replies; 4+ messages in thread
From: Stas Sergeev @ 2005-02-21 17:41 UTC (permalink / raw)
  To: Russell King; +Cc: Alan Cox, Linux Kernel Mailing List

<><>

<><><>Hello.

Russell King wrote:
>> Known bug, just nobody has bothered to fix it. Please send the fix to
>> Linus so it gets into 2.6.11
> The fix was submitted to and accepted by Linus on Feb 8th.  Therefore,
> there's nothing to "bother" with.
I've seen that fix in the latest -mm
patch released shortly after I wrote
the original message, but I can't help
feeling that the other serial drivers
have the same bug. I can see the very
same code in the au1x00_uart.c and other
files too, and it doesn't look like the
fix affected those.
I wasn't dare to ask, but now since also
Alan is bothered - can you please confirm
the other drivers are safe?

<>

<>

<>


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

end of thread, other threads:[~2005-02-21 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-07 20:30 lockup when accessing serial port (and fix) Stas Sergeev
2005-02-21 15:03 ` Alan Cox
2005-02-21 17:12   ` Russell King
2005-02-21 17:41     ` Stas Sergeev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox