summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-21 01:03:50 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-21 01:03:50 +0000
commitf56d090408425024e77aa59eba7f28357ce99ea6 (patch)
treec0f50aeedbad0016fe5331d0487d5b9f17fd503f /sys
parented0e1ae04df361574b8d7f30ba851c5eda367cf8 (diff)
drm/amdkfd: fix sysfs kobj leak
From Philip Yang b3205768cd1a3a9869500ec27e129f8a71d2152a in linux 5.10.y/5.10.52 dcdb4d904b4bd3078fe8d4d24b1658560d6078ef in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/amd/amdkfd/kfd_process.c14
-rw-r--r--sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c1
2 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_process.c b/sys/dev/pci/drm/amd/amdkfd/kfd_process.c
index 65803e153a2..d243e60c6ee 100644
--- a/sys/dev/pci/drm/amd/amdkfd/kfd_process.c
+++ b/sys/dev/pci/drm/amd/amdkfd/kfd_process.c
@@ -452,13 +452,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)
@@ -973,9 +969,11 @@ static void kfd_process_wq_release(struct work_struct *work)
list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
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;
diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c b/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c
index eb1635ac898..43c07ac2c6f 100644
--- a/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -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);