]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amdgpu: fix potential NULL pointer when check_atom_bios() fails
authorJiawei Gu <Jiawei.Gu@amd.com>
Wed, 23 Dec 2020 05:54:57 +0000 (13:54 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 5 Jan 2021 16:32:30 +0000 (11:32 -0500)
Asic funcs pointer needs being checked whether is NULL. Because when
check_atom_bios() fails in req_init_data handshake, asic funcs pointer
is not initialized yet.

Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c

index 6333cada1e096229bdee93af87d7c7d6d17e91e5..efdf639f6593546d852e81e9bccd454dc6571027 100644 (file)
@@ -155,7 +155,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)
        u8 header[AMD_VBIOS_SIGNATURE_END+1] = {0};
        int len;
 
-       if (!adev->asic_funcs->read_bios_from_rom)
+       if (!adev->asic_funcs || !adev->asic_funcs->read_bios_from_rom)
                return false;
 
        /* validate VBIOS signature */
@@ -348,7 +348,8 @@ static bool amdgpu_read_disabled_bios(struct amdgpu_device *adev)
        if (adev->flags & AMD_IS_APU)
                return igp_read_bios_from_vram(adev);
        else
-               return amdgpu_asic_read_disabled_bios(adev);
+               return (!adev->asic_funcs || !adev->asic_funcs->read_disabled_bios) ?
+                       false : amdgpu_asic_read_disabled_bios(adev);
 }
 
 #ifdef CONFIG_ACPI