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:05:49 +0000 (16:05 +0200)
commitb3205768cd1a3a9869500ec27e129f8a71d2152a
tree408f8c3e03ae069d1bae2c2021cf6b52f014bd6b
parent687875fa9c3b27319985fea40b83677e89e17be4
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