]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported
authorAntonio Quartulli <antonio@mandelbit.com>
Thu, 31 Oct 2024 15:28:48 +0000 (16:28 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Nov 2024 17:48:21 +0000 (12:48 -0500)
commita6dd15981c03f2cdc9a351a278f09b5479d53d2e
treebb4448ccb7e3919eda1fa6974a10a6a9712489f6
parent694c79769cb384bca8b1ec1d1e84156e726bd106
drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported

acpi_evaluate_object() may return AE_NOT_FOUND (failure), which
would result in dereferencing buffer.pointer (obj) while being NULL.

Although this case may be unrealistic for the current code, it is
still better to protect against possible bugs.

Bail out also when status is AE_NOT_FOUND.

This fixes 1 FORWARD_NULL issue reported by Coverity
Report: CID 1600951:  Null pointer dereferences  (FORWARD_NULL)

Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Fixes: c9b7c809b89f ("drm/amd: Guard against bad data for ATIF ACPI method")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241031152848.4716-1-antonio@mandelbit.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 91c9e221fe2553edf2db71627d8453f083de87a1)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c