x86/mce: Check regs before accessing it
authorBorislav Petkov <bp@suse.de>
Fri, 17 Dec 2021 15:49:25 +0000 (16:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 11:02:44 +0000 (12:02 +0100)
commit4266bbb97e150126ecc8b73f07f80b4bf9fb7be3
tree86f45776168756fd795bc91da05630df98d28194
parentb439dda3160bb00737e61beec1493cdbf3e63d2e
x86/mce: Check regs before accessing it

commit 1acd85feba81084fcef00b73fc1601e42b77c5d8 upstream.

Commit in Fixes accesses pt_regs before checking whether it is NULL or
not. Make sure the NULL pointer check happens first.

Fixes: 0a5b288e85bb ("x86/mce: Prevent severity computation from being instrumented")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20211217102029.GA29708@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/mce/severity.c