]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
serial: core: Fix port mutex assert if lockdep disabled
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 3 May 2016 21:01:51 +0000 (14:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 May 2016 00:53:20 +0000 (17:53 -0700)
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>
drivers/tty/serial/serial_core.c

index d529b5ce66c711ad38be6d502dc2938e1a3f351d..a333c59cba2cf3fdc37d81dda232c1f7474660f5 100644 (file)
@@ -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;
 }