Skip to contentSkip to conversation

Patch "serial: sh-sci: Fix panic when serial console and DMA are enabled" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jun 12, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

serial: sh-sci: Fix panic when serial console and DMA are enabled

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
serial-sh-sci-fix-panic-when-serial-console-and-dma-are-enabled.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 3c9101766b502a0163d1d437fada5801cf616be2 Mon Sep 17 00:00:00 2001

From: Takatoshi Akiyama <[email protected]>
Date: Mon, 27 Feb 2017 15:56:31 +0900
Subject: serial: sh-sci: Fix panic when serial console and DMA are enabled

From: Takatoshi Akiyama <[email protected]>

commit 3c9101766b502a0163d1d437fada5801cf616be2 upstream.

This patch fixes an issue that kernel panic happens when DMA is enabled and we press enter key while the kernel booting on the serial console.

* An interrupt may occur after sci_request_irq().
* DMA transfer area is initialized by setup_timer() in sci_request_dma() and used in interrupt.

If an interrupt occurred between sci_request_irq() and setup_timer() in sci_request_dma(), DMA transfer area has not been initialized yet. So, this patch changes the order of sci_request_irq() and sci_request_dma().

Fixes 73a19e4c0301 ("serial: sh-sci: Add DMA support.")
[Shimoda changes the commit log]
Cc Jiri Slaby <[email protected]>
---
 drivers/tty/serial/sh-sci.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/tty/serial/sh-sci.c +6 -4
@@ -1976,11 +1976,13 @@ static int sci_startup(struct uart_port
 
 	dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);
 
+	sci_request_dma(port);
+
 	ret = sci_request_irq(s);
-	if (unlikely(ret < 0))
+	if (unlikely(ret < 0)) {
+		sci_free_dma(port);
 		return ret;
-
-	sci_request_dma(port);
+	}
 
 	return 0;
 }
@@ -2012,8 +2014,8 @@ static void sci_shutdown(struct uart_por
 	}
 #endif
 
-	sci_free_dma(port);
 	sci_free_irq(s);
+	sci_free_dma(port);
 }
 
 static int sci_sck_calc(struct sci_port *s, unsigned int bps,

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/serial-sh-sci-fix-panic-when-serial-console-and-dma-are-enabled.patch