x86/nmi: Make register_nmi_handler() more robust
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2181172
x86/nmi: Make register_nmi_handler() more robust
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2181172
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
(cherry picked from commit a7fed5c0431dbfa707037848830f980e0f93cfb3)
Signed-off-by: Ani Sinha anisinha@redhat.com
Edited by Mohamed Gamal Morsy