lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 13 Mar 2022 20:10:35 -0700
From:   Yongzhi Liu <lyz_cs@....edu.cn>
To:     leon@...nel.org
Cc:     yishaih@...lanox.com, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org, jgg@...pe.ca,
        Yongzhi Liu <lyz_cs@....edu.cn>
Subject: [PATCH v2] RDMA/mlx5: Fix memory leak in error subscribe event routine

In case second xa_insert() fails, the obj_event is not released.
Fix the error unwind flow to free that memory to avoid memory leak.

Fixes: 7597385 ("IB/mlx5: Enable subscription for device events over DEVX")
Signed-off-by: Yongzhi Liu <lyz_cs@....edu.cn>
---
 drivers/infiniband/hw/mlx5/devx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index 08b7f6b..15c0884 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -1886,8 +1886,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table,
 				key_level2,
 				obj_event,
 				GFP_KERNEL);
-		if (err)
+		if (err) {
+			kfree(obj_event);
 			return err;
+		}
 		INIT_LIST_HEAD(&obj_event->obj_sub_list);
 	}
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ