Skip to contentSkip to conversation

tty: serial: men_z135_uart.c: Updates for men_z135_uart

PATCH In review Johannes Thumshirn 2 participants 4 messages Aug 6, 2015 1 message not in the archive TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

v2 cover tty: serial: men_z135_uart.c: Updates for men_z135_uart

Version two of the updates for the men_z135_uart, incorporating Peter's review comments.

1/2: Use spin_lock_irq() in settermios() and spin_lock() in ISR to avoid
deadlocks.
2/2: Removes the double initialization of the port.lock spinlock.

Johannes Thumshirn (2):
tty: serial: men_z135_uart.c: Fix race between IRQ and set_termios()
tty: serial: men_z135_uart.c: Don't initialize port->lock

 drivers/tty/serial/men_z135_uart.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
Signature · 1 line
2.4.6
#1 lore raw

PATCH v2 2/2 tty: serial: men_z135_uart.c: Don't initialize port->lock

port->lock get's initialized in uart_add_one_port(), no need to do it in men_z135_probe().

---
 drivers/tty/serial/men_z135_uart.c | 1 -
 1 file changed, 1 deletion(-)
drivers/tty/serial/men_z135_uart.c +0 -1
index 5a41b8fb..b90e7b3 100644
@@ -839,7 +839,6 @@ static int men_z135_probe(struct mcb_device *mdev,
 	uart->port.membase = NULL;
 	uart->mdev = mdev;
 
-	spin_lock_init(&uart->port.lock);
 	spin_lock_init(&uart->lock);
 
 	err = uart_add_one_port(&men_z135_driver, &uart->port);
Signature · 1 line
2.4.6
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH 2/2] tty: serial: men_z135_uart.c: Don't initialize port->lock

Quoted 2 lines · Johannes Thumshirn

port->lock get's initialized in uart_add_one_port(), no need to do it in men_z135_probe().

A message that is not in the archive (sent off-list or not yet received): 535885237699310100f3e6804b3677495634042e.1438844880.git.jthumshirn@suse.de

Reviewed-by
#4 lore raw

Re: [PATCHv2 1/2] tty: serial: men_z135_uart.c: Fix race between IRQ and set_termios()

Quoted 10 lines · Johannes Thumshirn

Fix panic caused by a race between men_z135_intr() and men_z135_set_termios().

men_z135_intr() and men_z135_set_termios() both hold the struct uart_port::lock spinlock, but men_z135_intr() does a spin_lock_irqsave() and men_z135_set_termios() does a normal spin_lock(), which can lead to a deadlock when an interrupt is called while the lock is being helt by men_z135_set_termios().

This was discovered using a insmod, hardware looppback send/receive, rmmod stress test.