From 721cc05bbb7dd47f03fbff130b8dd67e01a6e1e2 Mon Sep 17 00:00:00 2001 From: Chen Zhou Date: Mon, 29 Nov 2021 16:28:56 +0800 Subject: [PATCH] printk/panic: prevent spin waiting in printk() hulk inclusion category: bugfix bugzilla: 41832, https://gitee.com/openeuler/kernel/issues/I4JKT1 CVE: NA ----------------------------------------------- When one cpu panic, the panic cpu send NMI to other cpus, if one of the non-panic cpus is in printk() and get stopped before release console_waiter, the panic cpu may spin waiting. Here just release console_waiter directly after all non-panic cpus get stopped. Signed-off-by: Chen Zhou Reviewed-by: Jian Cheng Reviewed-by: Xie XiuQi Signed-off-by: Chen Zhou Signed-off-by: Cheng Jian Reviewed-by: Xie XiuQi Signed-off-by: Zheng Zengkai --- kernel/printk/printk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index bf58d5777bce..e4328bc341f3 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1751,9 +1751,10 @@ void zap_locks(void) if (raw_spin_is_locked(&console_owner_lock)) { raw_spin_lock_init(&console_owner_lock); - console_owner = NULL; - console_waiter = false; } + + console_owner = NULL; + console_waiter = false; } /** -- GitLab