mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
ACPI: APEI: EINJ: fix potential NULL dereference in __einj_error_inject()
The __einj_error_inject() function allocates memory via kmalloc()
without checking for allocation failure, which could lead to a
NULL pointer dereference.
Return -ENOMEM in case allocation fails.
Fixes: b47610296d
("ACPI: APEI: EINJ: Enable EINJv2 error injections")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Link: https://patch.msgid.link/20250815024207.3038-1-hanchunchao@inspur.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
6c70585149
commit
7459e87ae1
@ -540,6 +540,9 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
|
|||||||
struct set_error_type_with_address *v5param;
|
struct set_error_type_with_address *v5param;
|
||||||
|
|
||||||
v5param = kmalloc(v5param_size, GFP_KERNEL);
|
v5param = kmalloc(v5param_size, GFP_KERNEL);
|
||||||
|
if (!v5param)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy_fromio(v5param, einj_param, v5param_size);
|
memcpy_fromio(v5param, einj_param, v5param_size);
|
||||||
v5param->type = type;
|
v5param->type = type;
|
||||||
if (type & ACPI5_VENDOR_BIT) {
|
if (type & ACPI5_VENDOR_BIT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user