Skip to content

Commit 79531bb

Browse files
committed
ACPI: APEI: EINJ: fix potential NULL dereference in __einj_error_inject()
JIRA: https://issues.redhat.com/browse/RHEL-114092 commit 7459e87 Author: Charles Han <hanchunchao@inspur.com> Date: Mon, 18 Aug 2025 18:10:15 +0000 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: b476102 ("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> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent 0881667 commit 79531bb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/acpi/apei/einj-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
540540
struct set_error_type_with_address *v5param;
541541

542542
v5param = kmalloc(v5param_size, GFP_KERNEL);
543+
if (!v5param)
544+
return -ENOMEM;
545+
543546
memcpy_fromio(v5param, einj_param, v5param_size);
544547
v5param->type = type;
545548
if (type & ACPI5_VENDOR_BIT) {

0 commit comments

Comments
 (0)