public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 0/2] tty: serial: men_z135_uart.c: Updates for men_z135_uart
@ 2015-08-06  7:16 Johannes Thumshirn
  2015-08-06  7:16 ` [PATCH 2/2] tty: serial: men_z135_uart.c: Don't initialize port->lock Johannes Thumshirn
       [not found] ` <535885237699310100f3e6804b3677495634042e.1438844880.git.jthumshirn@suse.de>
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2015-08-06  7:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: linux-serial, linux-kernel, Peter Hurley, Andreas Werner,
	Johannes Thumshirn

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(-)

-- 
2.4.6


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

* [PATCH 2/2] tty: serial: men_z135_uart.c: Don't initialize port->lock
  2015-08-06  7:16 [PATCHv2 0/2] tty: serial: men_z135_uart.c: Updates for men_z135_uart Johannes Thumshirn
@ 2015-08-06  7:16 ` Johannes Thumshirn
  2015-08-06 11:29   ` Peter Hurley
       [not found] ` <535885237699310100f3e6804b3677495634042e.1438844880.git.jthumshirn@suse.de>
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Thumshirn @ 2015-08-06  7:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: linux-serial, linux-kernel, Peter Hurley, Andreas Werner,
	Johannes Thumshirn

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

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/men_z135_uart.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c
index 5a41b8fb..b90e7b3 100644
--- a/drivers/tty/serial/men_z135_uart.c
+++ b/drivers/tty/serial/men_z135_uart.c
@@ -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);
-- 
2.4.6


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

* Re: [PATCHv2 1/2] tty: serial: men_z135_uart.c: Fix race between IRQ and set_termios()
       [not found] ` <535885237699310100f3e6804b3677495634042e.1438844880.git.jthumshirn@suse.de>
@ 2015-08-06 11:29   ` Peter Hurley
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Hurley @ 2015-08-06 11:29 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel,
	Andreas Werner

On 08/06/2015 03:16 AM, Johannes Thumshirn wrote:
> 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.

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>



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

* Re: [PATCH 2/2] tty: serial: men_z135_uart.c: Don't initialize port->lock
  2015-08-06  7:16 ` [PATCH 2/2] tty: serial: men_z135_uart.c: Don't initialize port->lock Johannes Thumshirn
@ 2015-08-06 11:29   ` Peter Hurley
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Hurley @ 2015-08-06 11:29 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel,
	Andreas Werner

On 08/06/2015 03:16 AM, Johannes Thumshirn wrote:
> port->lock get's initialized in uart_add_one_port(), no need to do it
> in men_z135_probe().

Reviewed-by: Peter Hurley <peter@hurleysoftware.com>


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

end of thread, other threads:[~2015-08-06 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06  7:16 [PATCHv2 0/2] tty: serial: men_z135_uart.c: Updates for men_z135_uart Johannes Thumshirn
2015-08-06  7:16 ` [PATCH 2/2] tty: serial: men_z135_uart.c: Don't initialize port->lock Johannes Thumshirn
2015-08-06 11:29   ` Peter Hurley
     [not found] ` <535885237699310100f3e6804b3677495634042e.1438844880.git.jthumshirn@suse.de>
2015-08-06 11:29   ` [PATCHv2 1/2] tty: serial: men_z135_uart.c: Fix race between IRQ and set_termios() Peter Hurley

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