kernel: add missing patch
[oweals/openwrt.git] / target / linux / generic / pending-4.9 / 890-uart_optional_sysrq.patch
1 From: John Crispin <john@phrozen.org>
2 Subject: serial: do not accept sysrq characters via serial port
3
4 many embedded boards have a disconnected TTL level serial which can
5 generate some garbage that can lead to spurious false sysrq detects.
6
7 [john@phrozen.org: sent upstream 22.12.2016]
8
9 Signed-off-by: John Crispin <john@phrozen.org>
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12  include/linux/serial_core.h | 2 +-
13  lib/Kconfig.debug           | 5 +++++
14  2 files changed, 6 insertions(+), 1 deletion(-)
15
16 diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
17 index 344201437017..7e6165bc1cef 100644
18 --- a/include/linux/serial_core.h
19 +++ b/include/linux/serial_core.h
20 @@ -448,7 +448,7 @@ extern void uart_handle_cts_change(struct uart_port *uport,
21  extern void uart_insert_char(struct uart_port *port, unsigned int status,
22                  unsigned int overrun, unsigned int ch, unsigned int flag);
23  
24 -#ifdef SUPPORT_SYSRQ
25 +#if defined(SUPPORT_SYSRQ) && defined(CONFIG_MAGIC_SYSRQ_SERIAL)
26  static inline int
27  uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
28  {
29 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
30 index a6c8db1d62f6..062c580cdd68 100644
31 --- a/lib/Kconfig.debug
32 +++ b/lib/Kconfig.debug
33 @@ -397,6 +397,11 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE
34           This may be set to 1 or 0 to enable or disable them all, or
35           to a bitmask as described in Documentation/sysrq.txt.
36  
37 +config MAGIC_SYSRQ_SERIAL
38 +       bool "Enable magic SysRq key over serial"
39 +       depends on MAGIC_SYSRQ
40 +       default y
41 +
42  config DEBUG_KERNEL
43         bool "Kernel debugging"
44         help
45 -- 
46 2.11.0
47