mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 16:58:53 +00:00
serial: core: Fix port mutex assert if lockdep disabled
commit 4047b37122d1 ("serial: core: Prevent unsafe uart port access, part 1") added lockdep assertion for port mutex but fails to check if debug_locks has disabled lockdep (so lock state is no longer reliable). Use lockdep_assert_held() instead, which properly checks lockdep state as well. Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6550be9f62
commit
7da4b8b737
@ -95,9 +95,7 @@ static inline void uart_port_deref(struct uart_port *uport)
|
||||
|
||||
static inline struct uart_port *uart_port_check(struct uart_state *state)
|
||||
{
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
WARN_ON(!lockdep_is_held(&state->port.mutex));
|
||||
#endif
|
||||
lockdep_assert_held(&state->port.mutex);
|
||||
return state->uart_port;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user