diff options
author | Ahung Cheng <[email protected]> | 2019-08-12 16:58:13 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2019-09-04 12:43:54 +0200 |
commit | 18a4c404d2b4de47da519955ddda0b153c03f12d (patch) | |
tree | 9646656d1b4027f00878473791ecce9e1b2badec | |
parent | 6300b140c29fdcd45e84fb551196a6e38dadddcc (diff) |
serial: tegra: protect IER against LCR.DLAB
The IER and DLH registers occupy the same address space, selected by
the LCR.DLAB bit. Hence, add port lock to protect IER when LCR.DLAB bit
is set.
Signed-off-by: Ahung Cheng <[email protected]>
Signed-off-by: Krishna Yarlagadda <[email protected]>
Acked-by: Thierry Reding <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r-- | drivers/tty/serial/serial-tegra.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index 83cc8dca58d4..82a8d5130cbc 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -294,6 +294,7 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud) unsigned long rate; unsigned int divisor; unsigned long lcr; + unsigned long flags; int ret; if (tup->current_baud == baud) @@ -313,6 +314,7 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud) divisor = DIV_ROUND_CLOSEST(rate, baud * 16); } + spin_lock_irqsave(&tup->uport.lock, flags); lcr = tup->lcr_shadow; lcr |= UART_LCR_DLAB; tegra_uart_write(tup, lcr, UART_LCR); @@ -325,6 +327,7 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud) /* Dummy read to ensure the write is posted */ tegra_uart_read(tup, UART_SCR); + spin_unlock_irqrestore(&tup->uport.lock, flags); tup->current_baud = baud; |