Skip to content

Commit 3c0fcb5

Browse files
akiyama-HISOLgregkh
authored andcommitted
serial: sh-sci: Fix panic when serial console and DMA are enabled
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: 73a19e4 ("serial: sh-sci: Add DMA support.") Signed-off-by: Takatoshi Akiyama <takatoshi.akiyama.kj@ps.hitachi-solutions.com> [Shimoda changes the commit log] Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cc04a14 commit 3c0fcb5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/tty/serial/sh-sci.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,11 +1800,13 @@ static int sci_startup(struct uart_port *port)
18001800

18011801
dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);
18021802

1803+
sci_request_dma(port);
1804+
18031805
ret = sci_request_irq(s);
1804-
if (unlikely(ret < 0))
1806+
if (unlikely(ret < 0)) {
1807+
sci_free_dma(port);
18051808
return ret;
1806-
1807-
sci_request_dma(port);
1809+
}
18081810

18091811
spin_lock_irqsave(&port->lock, flags);
18101812
sci_start_tx(port);
@@ -1834,8 +1836,8 @@ static void sci_shutdown(struct uart_port *port)
18341836
}
18351837
#endif
18361838

1837-
sci_free_dma(port);
18381839
sci_free_irq(s);
1840+
sci_free_dma(port);
18391841
}
18401842

18411843
static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps,

0 commit comments

Comments
 (0)