2020-05-03 07:36:25

by Dongyang Zhan

[permalink] [raw]
Subject: Possible null pointer dereference in smp_init_package_map()

Hi,

I am a security researcher, my name is Dongyang Zhan. I found a potential bug.

I hope you can help me to confirm it.

Thank you.

In Linux 4.10.17, smp_init_package_map() in /arch/x86/kernel/smpboot.c
does not handle the failure of memory allocation, which may cause a
null pointer dereference bug.

Source code link:
https://elixir.bootlin.com/linux/v4.10.17/source/arch/x86/kernel/smpboot.c#L326

Source code and comments:
physical_to_logical_pkg = kmalloc(size, GFP_KERNEL);
memset(physical_to_logical_pkg, 0xff, size); // does not check if kmalloc fails