From: Peter Hurley Date: Tue, 3 May 2016 21:01:51 +0000 (-0700) Subject: serial: core: Fix port mutex assert if lockdep disabled X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7da4b8b7378790dd1e4af1bb7522863127fa1438;p=linux-beck.git 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 Signed-off-by: Peter Hurley Tested-by: Tony Lindgren Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index d529b5ce66c7..a333c59cba2c 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -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; }