Skip to content

Commit a6dd159

Browse files
ordexalexdeucher
authored andcommitted
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: c9b7c80 ("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 91c9e22) Cc: stable@vger.kernel.org
1 parent 694c797 commit a6dd159

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ static union acpi_object *amdgpu_atif_call(struct amdgpu_atif *atif,
172172
&buffer);
173173
obj = (union acpi_object *)buffer.pointer;
174174

175-
/* Fail if calling the method fails and ATIF is supported */
176-
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
175+
/* Fail if calling the method fails */
176+
if (ACPI_FAILURE(status)) {
177177
DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
178178
acpi_format_exception(status));
179179
kfree(obj);

0 commit comments

Comments
 (0)