drm/amdkfd: kfree the wrong pointer
authorJack Zhang <Jack.Zhang1@amd.com>
Wed, 1 Apr 2020 12:06:58 +0000 (20:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:36:38 +0000 (10:36 +0200)
[ Upstream commit 3148a6a0ef3cf93570f30a477292768f7eb5d3c3 ]

Originally, it kfrees the wrong pointer for mem_obj.
It would cause memory leak under stress test.

Signed-off-by: Jack Zhang <Jack.Zhang1@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdkfd/kfd_device.c

index 0dc1084..ad9483b 100644 (file)
@@ -1112,9 +1112,9 @@ kfd_gtt_out:
        return 0;
 
 kfd_gtt_no_free_chunk:
-       pr_debug("Allocation failed with mem_obj = %p\n", mem_obj);
+       pr_debug("Allocation failed with mem_obj = %p\n", *mem_obj);
        mutex_unlock(&kfd->gtt_sa_lock);
-       kfree(mem_obj);
+       kfree(*mem_obj);
        return -ENOMEM;
 }