[PATCH 037/190] Revert "RDMA/core: Fix several reference count leaks."

Greg Kroah-Hartman
2021-04-21T13:05:45Z

This reverts commit 0b8e125e213204508e1b3c4bdfe69713280b7abd.

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: https
Cc: Qiushi Wu <wu000273@umn.edu>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/core/sysfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index b8abb30f80df..1ff580362a7c 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -1076,7 +1076,8 @@ static int add_port(struct ib_core_device *coredev, int port_num)
coredev->ports_kobj,
"%d", port_num);
if (ret) {
- goto err_put;
+ kfree(p);
+ return ret;
}

p->gid_attr_group = kzalloc(sizeof(*p->gid_attr_group), GFP_KERNEL);
@@ -1089,7 +1090,8 @@ static int add_port(struct ib_core_device *coredev, int port_num)
ret = kobject_init_and_add(&p->gid_attr_group->kobj, &gid_attr_type,
&p->kobj, "gid_attrs");
if (ret) {
- goto err_put_gid_attrs;
+ kfree(p->gid_attr_group);
+ goto err_put;
}

if (device->ops.process_mad && is_full_dev) {
@@ -1452,10 +1454,8 @@ int ib_port_register_module_stat(struct ib_device *device, u8 port_num,

ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s",
name);
- if (ret) {
- kobject_put(kobj);
+ if (ret)
return ret;
- }
}

return 0;
--
2.31.1