drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()'
authorjsg <jsg@openbsd.org>
Tue, 6 Feb 2024 03:45:17 +0000 (03:45 +0000)
committerjsg <jsg@openbsd.org>
Tue, 6 Feb 2024 03:45:17 +0000 (03:45 +0000)
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

index 8402d38..eebfd1c 100644 (file)
@@ -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;
 }