]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu/debugfs: fix memory leak when amdgpu_virt_enable_access_debugfs failed
authorChen Tao <chentao107@huawei.com>
Wed, 17 Jun 2020 10:51:30 +0000 (18:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:26:29 +0000 (08:26 +0200)
[ Upstream commit 888e32d71115e26b57bdcbc717c68e9c5026bac3 ]

Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when
amdgpu_virt_enable_access_debugfs failed.

Fixes: 95a2f917387a2 ("drm/amdgpu: restrict debugfs register access under SR-IOV")
Signed-off-by: Chen Tao <chentao107@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

index 386b979e0852285e19ead45b3ae707b0ae0fb8fb..f87b225437fc34ed1b1356b20a6de2a426f54e28 100644 (file)
@@ -977,7 +977,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
 
        r = amdgpu_virt_enable_access_debugfs(adev);
        if (r < 0)
-               return r;
+               goto err;
 
        /* switch to the specific se/sh/cu */
        mutex_lock(&adev->grbm_idx_mutex);