mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-19 09:04:57 +00:00
drm/amdkfd: fix sysfs kobj leak
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>
This commit is contained in:
parent
75ae84c89b
commit
dcdb4d904b
2 changed files with 7 additions and 8 deletions
|
@ -451,13 +451,9 @@ static const struct sysfs_ops procfs_stats_ops = {
|
|||
.show = kfd_procfs_stats_show,
|
||||
};
|
||||
|
||||
static struct attribute *procfs_stats_attrs[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct kobj_type procfs_stats_type = {
|
||||
.sysfs_ops = &procfs_stats_ops,
|
||||
.default_attrs = procfs_stats_attrs,
|
||||
.release = kfd_procfs_kobj_release,
|
||||
};
|
||||
|
||||
int kfd_procfs_add_queue(struct queue *q)
|
||||
|
@ -946,9 +942,11 @@ static void kfd_process_wq_release(struct work_struct *work)
|
|||
|
||||
sysfs_remove_file(p->kobj, &pdd->attr_vram);
|
||||
sysfs_remove_file(p->kobj, &pdd->attr_sdma);
|
||||
sysfs_remove_file(p->kobj, &pdd->attr_evict);
|
||||
if (pdd->dev->kfd2kgd->get_cu_occupancy != NULL)
|
||||
sysfs_remove_file(p->kobj, &pdd->attr_cu_occupancy);
|
||||
|
||||
sysfs_remove_file(pdd->kobj_stats, &pdd->attr_evict);
|
||||
if (pdd->dev->kfd2kgd->get_cu_occupancy)
|
||||
sysfs_remove_file(pdd->kobj_stats,
|
||||
&pdd->attr_cu_occupancy);
|
||||
kobject_del(pdd->kobj_stats);
|
||||
kobject_put(pdd->kobj_stats);
|
||||
pdd->kobj_stats = NULL;
|
||||
|
|
|
@ -153,6 +153,7 @@ void pqm_uninit(struct process_queue_manager *pqm)
|
|||
if (pqn->q && pqn->q->gws)
|
||||
amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info,
|
||||
pqn->q->gws);
|
||||
kfd_procfs_del_queue(pqn->q);
|
||||
uninit_queue(pqn->q);
|
||||
list_del(&pqn->process_queue_list);
|
||||
kfree(pqn);
|
||||
|
|
Loading…
Reference in a new issue