Skip to content

Commit 6b99f1a

Browse files
KAGA-KOKOgregkh
authored andcommitted
x86/mce/AMD: Make the init code more robust
[ Upstream commit 0dad3a3014a0b9e72521ff44f17e0054f43dcdea ] If mce_device_init() fails then the mce device pointer is NULL and the AMD mce code happily dereferences it. Add a sanity check. Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de> Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f7e0f7f commit 6b99f1a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/x86/kernel/cpu/mcheck/mce_amd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,9 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank)
682682
const char *name = th_names[bank];
683683
int err = 0;
684684

685+
if (!dev)
686+
return -ENODEV;
687+
685688
if (is_shared_bank(bank)) {
686689
nb = node_to_amd_nb(amd_get_nb_id(cpu));
687690

0 commit comments

Comments
 (0)