kdb: Check status of console prior to invoking handlers
authorSumit Garg <sumit.garg@linaro.org>
Thu, 4 Jun 2020 10:01:17 +0000 (15:31 +0530)
committerDaniel Thompson <daniel.thompson@linaro.org>
Thu, 25 Jun 2020 11:04:29 +0000 (12:04 +0100)
Check if a console is enabled prior to invoking corresponding write
handler.

Suggested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/1591264879-25920-3-git-send-email-sumit.garg@linaro.org
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_io.c

index 2d42a02de40e1d8f2f6e679c0fb666b9e5dda608..58b7d256d0a40de2ae42faaa415083626905a2e4 100644 (file)
@@ -560,6 +560,8 @@ static void kdb_msg_write(const char *msg, int msg_len)
        }
 
        for_each_console(c) {
        }
 
        for_each_console(c) {
+               if (!(c->flags & CON_ENABLED))
+                       continue;
                c->write(c, msg, msg_len);
                touch_nmi_watchdog();
        }
                c->write(c, msg, msg_len);
                touch_nmi_watchdog();
        }