]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Fix a potential issue in mpc52xx uart driver
authorAndrew Liu <shengping.liu@windriver.com>
Tue, 29 Apr 2008 07:36:25 +0000 (17:36 +1000)
committerGrant Likely <grant.likely@secretlab.ca>
Thu, 1 May 2008 17:59:12 +0000 (11:59 -0600)
mpc52xx_uart_int and __uart_put_char both try to acquire the
port->lock. Therefore the function sequence of:

mpc52xx_uart_int--> ...-->flush_to_ldisc-->...-->__uart_put_char

can potentially trigger a deadlock. To avoid this deadlock a fix
similar to that found in the 8250.c serial driver is applied. The
deadlock is avoided by releasing the lock before pushing a buffer
and reacquiring it when completed.

Signed-off-by: Andrew Liu <shengping.liu@windriver.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/serial/mpc52xx_uart.c

index 7a3625f52a03b837551697cf2bc23b54bc488d32..efc971d9647b20b7d09f773ba21e12c3b6407437 100644 (file)
@@ -783,7 +783,9 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
                }
        }
 
+       spin_unlock(&port->lock);
        tty_flip_buffer_push(tty);
+       spin_lock(&port->lock);
 
        return psc_ops->raw_rx_rdy(port);
 }