Skip to content

Commit bc03c02

Browse files
Ma Junalexdeucher
authored andcommitted
drm/amdgpu: Fix the null pointer when load rlc firmware
If the RLC firmware is invalid because of wrong header size, the pointer to the rlc firmware is released in function amdgpu_ucode_request. There will be a null pointer error in subsequent use. So skip validation to fix it. Fixes: 3da9b71 ("drm/amd: Use `amdgpu_ucode_*` helpers for GFX10") Signed-off-by: Ma Jun <Jun.Ma2@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent bfe79f5 commit bc03c02

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3996,16 +3996,13 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
39963996

39973997
if (!amdgpu_sriov_vf(adev)) {
39983998
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
3999-
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
4000-
/* don't check this. There are apparently firmwares in the wild with
4001-
* incorrect size in the header
4002-
*/
4003-
if (err == -ENODEV)
4004-
goto out;
3999+
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
40054000
if (err)
4006-
dev_dbg(adev->dev,
4007-
"gfx10: amdgpu_ucode_request() failed \"%s\"\n",
4008-
fw_name);
4001+
goto out;
4002+
4003+
/* don't validate this firmware. There are apparently firmwares
4004+
* in the wild with incorrect size in the header
4005+
*/
40094006
rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
40104007
version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
40114008
version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);

0 commit comments

Comments
 (0)