diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2022-05-15 14:39:34 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-05-17 10:25:25 +0300 |
commit | a7fed5c0431dbfa707037848830f980e0f93cfb3 (patch) | |
tree | f915d1b77fa76c9d4ef18b0c3f7a0164665e97dc /arch/x86/include/asm/nmi.h | |
parent | 203d8919a9eda5d1bc68ac3cd7637588334c9dc1 (diff) | |
download | linux-a7fed5c0431dbfa707037848830f980e0f93cfb3.tar.xz |
x86/nmi: Make register_nmi_handler() more robust
register_nmi_handler() has no sanity check whether a handler has been
registered already. Such an unintended double-add leads to list corruption
and hard to diagnose problems during the next NMI handling.
Init the list head in the static NMI action struct and check it for being
empty in register_nmi_handler().
[ bp: Fixups. ]
Reported-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/lkml/20220511234332.3654455-1-seanjc@google.com
Diffstat (limited to 'arch/x86/include/asm/nmi.h')
-rw-r--r-- | arch/x86/include/asm/nmi.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h index 1cb9c17a4cb4..5c5f1e56c404 100644 --- a/arch/x86/include/asm/nmi.h +++ b/arch/x86/include/asm/nmi.h @@ -47,6 +47,7 @@ struct nmiaction { #define register_nmi_handler(t, fn, fg, n, init...) \ ({ \ static struct nmiaction init fn##_na = { \ + .list = LIST_HEAD_INIT(fn##_na.list), \ .handler = (fn), \ .name = (n), \ .flags = (fg), \ |