]> Git Repo - linux.git/commitdiff
drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported
authorAntonio Quartulli <[email protected]>
Thu, 31 Oct 2024 15:28:48 +0000 (16:28 +0100)
committerAlex Deucher <[email protected]>
Mon, 4 Nov 2024 17:05:16 +0000 (12:05 -0500)
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 <[email protected]>
Fixes: c9b7c809b89f ("drm/amd: Guard against bad data for ATIF ACPI method")
Reviewed-by: Mario Limonciello <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mario Limonciello <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

index cce85389427f3530dc4970d1ca058bb03ba27970..b8d4e07d2043ed5425dab987fa8e519c9a06dbcc 100644 (file)
@@ -172,8 +172,8 @@ static union acpi_object *amdgpu_atif_call(struct amdgpu_atif *atif,
                                      &buffer);
        obj = (union acpi_object *)buffer.pointer;
 
-       /* Fail if calling the method fails and ATIF is supported */
-       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+       /* Fail if calling the method fails */
+       if (ACPI_FAILURE(status)) {
                DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
                                 acpi_format_exception(status));
                kfree(obj);
This page took 0.057275 seconds and 4 git commands to generate.