From: jsg Date: Tue, 6 Feb 2024 03:45:17 +0000 (+0000) Subject: drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()' X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9fce72ccdf71aff3a9753dcbc97cb2647807e0bd;p=openbsd 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 --- 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; }