]> git.itanic.dy.fi Git - linux-stable/commit
tty: serial: imx: fix potential deadlock
authorSam Nobs <samuel.nobs@taitradio.com>
Mon, 9 Nov 2020 20:50:06 +0000 (09:50 +1300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Nov 2020 08:32:49 +0000 (09:32 +0100)
commit33f16855dcb973f745c51882d0e286601ff3be2b
treef08ae232f11698405d303c2ff9e0a1feacb0dc04
parentf8394f232b1eab649ce2df5c5f15b0e528c92091
tty: serial: imx: fix potential deadlock

Enabling the lock dependency validator has revealed
that the way spinlocks are used in the IMX serial
port could result in a deadlock.

Specifically, imx_uart_int() acquires a spinlock
without disabling the interrupts, meaning that another
interrupt could come along and try to acquire the same
spinlock, potentially causing the two to wait for each
other indefinitely.

Use spin_lock_irqsave() instead to disable interrupts
upon acquisition of the spinlock.

Fixes: c974991d2620 ("tty:serial:imx: use spin_lock instead of spin_lock_irqsave in isr")
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sam Nobs <samuel.nobs@taitradio.com>
Link: https://lore.kernel.org/r/1604955006-9363-1-git-send-email-samuel.nobs@taitradio.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c