]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amdkfd: fix sysfs kobj leak
authorPhilip Yang <Philip.Yang@amd.com>
Mon, 21 Jun 2021 22:51:26 +0000 (18:51 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:16 +0000 (16:02 +0200)
commitcb22d34a402fda5de3cfe21fa7ab8dbbc49a5fb4
tree8bbbce219bcf01f9ffc4bfc06b89d7fcca38922d
parentdbe21a80c698c7e79362fbc18ab81c7377ef8732
drm/amdkfd: fix sysfs kobj leak

[ Upstream commit dcdb4d904b4bd3078fe8d4d24b1658560d6078ef ]

3 cases of kobj leak, which causes memory leak:

kobj_type must have release() method to free memory from release
callback. Don't need NULL default_attrs to init kobj.

sysfs files created under kobj_status should be removed with kobj_status
as parent kobject.

Remove queue sysfs files when releasing queue from process MMU notifier
release callback.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@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_process.c
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c