serial: imx: fix locking in set_termios()
authorSergey Organov <sorganov@gmail.com>
Tue, 11 Jun 2019 12:05:24 +0000 (15:05 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:27:01 +0000 (07:27 +0200)
commit785e11c06db3ebd154fa1cf290170269140a5285
treea1521280bd607b61ca09d464eb496f602cbedb83
parent741f8b39b6d4fe284ede321732484059ab7d27a4
serial: imx: fix locking in set_termios()

[ Upstream commit 4e828c3e09201512be5ee162393f334321f7cf01 ]

imx_uart_set_termios() called imx_uart_rts_active(), or
imx_uart_rts_inactive() before taking port->port.lock.

As a consequence, sport->port.mctrl that these functions modify
could have been changed without holding port->port.lock.

Moved locking of port->port.lock above the calls to fix the issue.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/imx.c