+ 8250-fix-possible-deadlock-between-serial8250_handle_port-and-serial8250_interrupt.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     8250: fix possible deadlock between serial8250_handle_port() and serial8250_interrupt()
has been added to the -mm tree.  Its filename is
     8250-fix-possible-deadlock-between-serial8250_handle_port-and-serial8250_interrupt.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: 8250: fix possible deadlock between serial8250_handle_port() and serial8250_interrupt()
From: Jiri Kosina <jkosina@xxxxxxx>

Commit 40b36daa introduced possibility that serial8250_backup_timeout() ->
serial8250_handle_port() locks port.lock without disabling irqs, thus
allowing deadlock against interrupt handler (port.lock is acquired in
serial8250_interrupt()).

Spotted by lockdep.

Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
Cc: Dave Jones <davej@xxxxxxxxxxxxxxxxx>
Cc: Russell King <rmk@xxxxxxxxxxxxxxxx>
Cc: Alex Williamson <alex.williamson@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/serial/8250.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff -puN drivers/serial/8250.c~8250-fix-possible-deadlock-between-serial8250_handle_port-and-serial8250_interrupt drivers/serial/8250.c
--- a/drivers/serial/8250.c~8250-fix-possible-deadlock-between-serial8250_handle_port-and-serial8250_interrupt
+++ a/drivers/serial/8250.c
@@ -1334,8 +1334,9 @@ static inline void
 serial8250_handle_port(struct uart_8250_port *up)
 {
 	unsigned int status;
+	unsigned long flags;
 
-	spin_lock(&up->port.lock);
+	spin_lock_irqsave(&up->port.lock, flags);
 
 	status = serial_inp(up, UART_LSR);
 
@@ -1347,7 +1348,7 @@ serial8250_handle_port(struct uart_8250_
 	if (status & UART_LSR_THRE)
 		transmit_chars(up);
 
-	spin_unlock(&up->port.lock);
+	spin_unlock_irqrestore(&up->port.lock, flags);
 }
 
 /*
_

Patches currently in -mm which might be from jkosina@xxxxxxx are

8250-fix-possible-deadlock-between-serial8250_handle_port-and-serial8250_interrupt.patch
git-hid.patch
git-ipwireless_cs.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux