Re: [PATCH 024/190] Revert "drm/amdkfd: Fix reference count leaks."

Felix Kuehling
2021-04-21T15:14:21Z

On 2021-04-21 8:58 a.m., Greg Kroah-Hartman wrote:
> This reverts commit 20eca0123a35305e38b344d571cf32768854168c.
>
> Commits from @umn.edu addresses have been found to be submitted in "bad
> faith" to try to test the kernel community's ability to review "known
> malicious" changes. The result of these submissions can be found in a
> paper published at the 42nd IEEE Symposium on Security and Privacy
> entitled, "Open Source Insecurity: Stealthily Introducing
> Vulnerabilities via Hypocrite Commits" written by Qiushi Wu (University
> of Minnesota) and Kangjie Lu (University of Minnesota).
>
> Because of this, all submissions from this group must be reverted from
> the kernel tree and will need to be re-reviewed again to determine if
> they actually are a valid fix. Until that work is complete, remove this
> change to ensure that no problems are being introduced into the
> codebase.
>
> Cc: Qiushi Wu <wu000273@umn.edu>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

As far as I can tell, this patch was correct and should not be reverted.

Thanks,
Felix

> ---
> drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 20 +++++---------------
> 1 file changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> index 0be72789ccbc..d3c3fa25c2cc 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> @@ -637,10 +637,8 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
>
> ret = kobject_init_and_add(dev->kobj_node, &node_type,
> sys_props.kobj_nodes, "%d", id);
> - if (ret < 0) {
> - kobject_put(dev->kobj_node);
> + if (ret < 0)
> return ret;
> - }
>
> dev->kobj_mem = kobject_create_and_add("mem_banks", dev->kobj_node);
> if (!dev->kobj_mem)
> @@ -687,10 +685,8 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
> return -ENOMEM;
> ret = kobject_init_and_add(mem->kobj, &mem_type,
> dev->kobj_mem, "%d", i);
> - if (ret < 0) {
> - kobject_put(mem->kobj);
> + if (ret < 0)
> return ret;
> - }
>
> mem->attr.name = "properties";
> mem->attr.mode = KFD_SYSFS_FILE_MODE;
> @@ -708,10 +704,8 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
> return -ENOMEM;
> ret = kobject_init_and_add(cache->kobj, &cache_type,
> dev->kobj_cache, "%d", i);
> - if (ret < 0) {
> - kobject_put(cache->kobj);
> + if (ret < 0)
> return ret;
> - }
>
> cache->attr.name = "properties";
> cache->attr.mode = KFD_SYSFS_FILE_MODE;
> @@ -729,10 +723,8 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
> return -ENOMEM;
> ret = kobject_init_and_add(iolink->kobj, &iolink_type,
> dev->kobj_iolink, "%d", i);
> - if (ret < 0) {
> - kobject_put(iolink->kobj);
> + if (ret < 0)
> return ret;
> - }
>
> iolink->attr.name = "properties";
> iolink->attr.mode = KFD_SYSFS_FILE_MODE;
> @@ -811,10 +803,8 @@ static int kfd_topology_update_sysfs(void)
> ret = kobject_init_and_add(sys_props.kobj_topology,
> &sysprops_type, &kfd_device->kobj,
> "topology");
> - if (ret < 0) {
> - kobject_put(sys_props.kobj_topology);
> + if (ret < 0)
> return ret;
> - }
>
> sys_props.kobj_nodes = kobject_create_and_add("nodes",
> sys_props.kobj_topology);