Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e370d2c authored by Rich Felker's avatar Rich Felker Committed by Greg Kroah-Hartman
Browse files

serial-uartlite: fix missing locking in isr



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: default avatarRich Felker <dalias@libc.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7cdcc29e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);