lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 8 Jan 2016 15:33:50 -0500
From:	Rich Felker <dalias@...c.org>
To:	Peter Korsgaard <jacmet@...site.dk>
Cc:	linux-serial@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] serial-uartlite: fix missing locking in isr

From: Rich Felker <dalias@...c.org>

The uartlite driver suffers from missing/duplicate/corrupted character
data when the interrupt handler runs concurrently with access to the
device from another cpu. Take the port spinlock to exclude concurrent
access.

Signed-off-by: Rich Felker <dalias@...c.org>

---

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 189f52e..3b818ec 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -194,7 +194,9 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
 {
 	struct uart_port *port = dev_id;
 	int busy, n = 0;
+	unsigned long flags;
 
+	spin_lock_irqsave(&port->lock, flags);
 	do {
 		int stat = uart_in32(ULITE_STATUS, port);
 		busy  = ulite_receive(port, stat);
@@ -202,6 +204,8 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
 		n++;
 	} while (busy);
 
+	spin_unlock_irqrestore(&port->lock, flags);
+
 	/* work done? */
 	if (n > 1) {
 		tty_flip_buffer_push(&port->state->port);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ