]> git.baikalelectronics.ru Git - kernel.git/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)
commitf6cd92bc5a7aaac3ebe7affcf40b0dc15fa5f917
treef08ae232f11698405d303c2ff9e0a1feacb0dc04
parentc264010cc5c3df68366b65702bff545bebd1b7d0
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: 798d6365dacd ("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