Skip to content

Commit 3c199ed

Browse files
esbengregkh
authored andcommitted
serial: imx: Grab port lock in imx_uart_enable_wakeup()
The port lock needs to be held when doing read-modify-write on UCR1 and UCR3. Signed-off-by: Esben Haabendal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5cbb9b1 commit 3c199ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/tty/serial/imx.c

+5
Original file line numberDiff line numberDiff line change
@@ -2580,10 +2580,13 @@ static void imx_uart_save_context(struct imx_port *sport)
25802580
uart_port_unlock_irqrestore(&sport->port, flags);
25812581
}
25822582

2583+
/* called with irq off */
25832584
static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
25842585
{
25852586
u32 ucr3;
25862587

2588+
uart_port_lock(&sport->port);
2589+
25872590
ucr3 = imx_uart_readl(sport, UCR3);
25882591
if (on) {
25892592
imx_uart_writel(sport, USR1_AWAKE, USR1);
@@ -2603,6 +2606,8 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
26032606
}
26042607
imx_uart_writel(sport, ucr1, UCR1);
26052608
}
2609+
2610+
uart_port_unlock(&sport->port);
26062611
}
26072612

26082613
static int imx_uart_suspend_noirq(struct device *dev)

0 commit comments

Comments
 (0)