git: 9f071039ca34 - main - sys/ofed: fix GID table reference leak in roce_gid_update_addr_callback()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Aug 2026 20:45:30 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=9f071039ca34801fee7727106e23b824e98ed4a9
commit 9f071039ca34801fee7727106e23b824e98ed4a9
Author: Ariel Ehrenberg <aehrenberg@nvidia.com>
AuthorDate: 2026-07-22 22:03:40 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-08-03 20:38:47 +0000
sys/ofed: fix GID table reference leak in roce_gid_update_addr_callback()
The "add missing GIDs" loop uses rdma_find_gid_by_port() to test whether
a GID already exists, but forgets to drop the reference it returns. So
every rescan that finds an existing GID leaks one, which pins the entry
and prevents its slot from ever being freed on delete.
Just release the reference once the GID is found, like the "remove stale
GIDs" loop already does.
Reported by: Wafa Hamzah <wafah@nvidia.com>
Reviewed by: kib, jhb
Sponsored by: Nvidia networking
Fixes: 6a75471dbcf0 ("OFED: Various changes from Linux 4.19")
Differential revision: https://reviews.freebsd.org/D58511
---
sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c
index e346f477d719..e24a6645e8e4 100644
--- a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c
+++ b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c
@@ -260,8 +260,10 @@ roce_gid_update_addr_callback(struct ib_device *device, u8 port,
/* check if entry found */
sgid_attr = rdma_find_gid_by_port(device, &gid, i,
port, entry->ndev);
- if (!IS_ERR(sgid_attr))
+ if (!IS_ERR(sgid_attr)) {
+ rdma_put_gid_attr(sgid_attr);
break;
+ }
}
if (i != IB_GID_TYPE_SIZE)
continue;