From 9fce72ccdf71aff3a9753dcbc97cb2647807e0bd Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 6 Feb 2024 03:45:17 +0000 Subject: [PATCH] drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()' From Srinivasan Shanmugam aa1791b280ed36005226e031a622091fa7e5382e in linux-6.6.y/6.6.16 13a1851f923d9a7a78a477497295c2dfd16ad4a4 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_ucode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ucode.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ucode.c index 8402d38f7b0..eebfd1c3869 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ucode.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ucode.c @@ -1330,9 +1330,13 @@ int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, if (err) return -ENODEV; + err = amdgpu_ucode_validate(*fw); - if (err) + if (err) { dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name); + release_firmware(*fw); + *fw = NULL; + } return err; } -- 2.20.1