Patch "drm/amdkfd: Fix memory leaks in kfd topology" has been added to the 4.15-stable tree
Subsystems (4)
This is a note to let you know that I've just added the patch titled
drm/amdkfd: Fix memory leaks in kfd topology
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
drm-amdkfd-fix-memory-leaks-in-kfd-topology.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Fri Mar 16 15:11:08 CET 2018
From: Yong Zhao <[email protected]>
Date: Fri, 8 Dec 2017 23:08:48 -0500
Subject: drm/amdkfd: Fix memory leaks in kfd topology
From: Yong Zhao <[email protected]>
[ Upstream commit 5108d768408abc80e4e8d99f5b406a73cb04056b ]
Kobject created using kobject_create_and_add() can be freed using kobject_put() when there is no referenece any more. However, kobject memory allocated with kzalloc() has to set up a release callback in order to free it when the counter decreases to 0. Otherwise it causes memory leak.
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +10 -0
@@ -501,11 +501,17 @@ static ssize_t sysprops_show(struct kobjreturn ret; } +static void kfd_topology_kobj_release (struct kobject *kobj) +{ +kfree (kobj); +} +static const struct sysfs_ops sysprops_ops = { .show = sysprops_show, };static struct kobj_type sysprops_type = { + .release = kfd_topology_kobj_release, .sysfs_ops = &sysprops_ops, };
@@ -541,6 +547,7 @@ static const struct sysfs_ops iolink_ops };static struct kobj_type iolink_type = { + .release = kfd_topology_kobj_release, .sysfs_ops = &iolink_ops, };
@@ -568,6 +575,7 @@ static const struct sysfs_ops mem_ops = };static struct kobj_type mem_type = { + .release = kfd_topology_kobj_release, .sysfs_ops = &mem_ops, };
@@ -607,6 +615,7 @@ static const struct sysfs_ops cache_ops };static struct kobj_type cache_type = { + .release = kfd_topology_kobj_release, .sysfs_ops = &cache_ops, };
@@ -729,6 +738,7 @@ static const struct sysfs_ops node_ops = };static struct kobj_type node_type = { + .release = kfd_topology_kobj_release, .sysfs_ops = &node_ops, };
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/drm-amdkfd-fix-memory-leaks-in-kfd-topology.patch