]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix a memory leak in amdgpu_ras_feature_enable
authorCong Liu <liucong2@kylinos.cn>
Thu, 14 Sep 2023 09:45:33 +0000 (17:45 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 20 Sep 2023 21:27:04 +0000 (17:27 -0400)
This patch fixes a memory leak in the amdgpu_ras_feature_enable() function.
The leak occurs when the function sends a command to the firmware to enable
or disable a RAS feature for a GFX block. If the command fails, the kfree()
function is not called to free the info memory.

Fixes: 9f051d6ff13f ("drm/amdgpu: Free ras cmd input buffer properly")
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index 937c54fc7174518ec80461616cf353423125bd65..163445baa4fc80a432209247e43c4fb76d4da979 100644 (file)
@@ -801,6 +801,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
                                enable ? "enable":"disable",
                                get_ras_block_str(head),
                                amdgpu_ras_is_poison_mode_supported(adev), ret);
+                       kfree(info);
                        return ret;
                }