[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55df184b-ec0a-4274-b60b-37e8ba323cb8@linux.intel.com>
Date: Tue, 15 Apr 2025 07:25:35 -0700
From: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Chenyuan Yang <chenyuan0y@...il.com>, rafael@...nel.org, lenb@...nel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com, bhe@...hat.com,
kai.huang@...el.com
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/acpi: fix potential NULL deref in acpi_wakeup_cpu()
On 4/11/25 12:48 PM, Chenyuan Yang wrote:
> The result of memremap() may be NULL on failure, leading to a NULL
> dereference. Add explicit checks after memremap() call: if the
> MADT mailbox fails to map, return immediately.
>
> This is similar to the commit 966d47e1f27c
> ("efi: fix potential NULL deref in efi_mem_reserve_persistent").
>
> This is found by our static analysis tool KNighter.
>
> Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
> Fixes: 2b5e22afae07 ("x86/acpi: Extract ACPI MADT wakeup code into a separate file")
> ---
Looks fine to me
Reviewed-by: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>
> arch/x86/kernel/acpi/madt_wakeup.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c
> index f36f28405dcc..b386ec4b87c2 100644
> --- a/arch/x86/kernel/acpi/madt_wakeup.c
> +++ b/arch/x86/kernel/acpi/madt_wakeup.c
> @@ -143,6 +143,10 @@ static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip)
> acpi_mp_wake_mailbox = memremap(acpi_mp_wake_mailbox_paddr,
> sizeof(*acpi_mp_wake_mailbox),
> MEMREMAP_WB);
> + if (!acpi_mp_wake_mailbox) {
> + pr_err("Failed to remap MADT mailbox\n");
> + return -ENOMEM;
> + }
> }
>
> /*
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
Powered by blists - more mailing lists