Created attachment 234221 [details] a possible patch cm_id, which is allocated by ib_create_cm_id, is not freed in an error path, causing a resource leak.
Have you checked if a fix exist in Linux?
Thank you! --HPS
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c4a415505311e30093b6d9ee0493427a66f2b0de commit c4a415505311e30093b6d9ee0493427a66f2b0de Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-05-30 18:19:33 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-05-30 18:22:18 +0000 ibcore: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen() The algorithm pre-allocates a cm_id since allocation cannot be done while holding the cm.lock spinlock, however it doesn't free it on one error path, leading to a memory leak. Linux commit: c14dfddbd869bf0c2bafb7ef260c41d9cebbcfec PR: 264248 MFC after: 1 week Sponsored by: NVIDIA Networking sys/ofed/drivers/infiniband/core/ib_cm.c | 1 + 1 file changed, 1 insertion(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5570397c129d490b909b1962f51376d6742eacf4 commit 5570397c129d490b909b1962f51376d6742eacf4 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-05-30 18:19:33 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-06-07 06:44:29 +0000 ibcore: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen() The algorithm pre-allocates a cm_id since allocation cannot be done while holding the cm.lock spinlock, however it doesn't free it on one error path, leading to a memory leak. Linux commit: c14dfddbd869bf0c2bafb7ef260c41d9cebbcfec PR: 264248 Sponsored by: NVIDIA Networking (cherry picked from commit c4a415505311e30093b6d9ee0493427a66f2b0de) sys/ofed/drivers/infiniband/core/ib_cm.c | 1 + 1 file changed, 1 insertion(+)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=dad7c072f482527b4964bbd4b067d06c6df2e592 commit dad7c072f482527b4964bbd4b067d06c6df2e592 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-05-30 18:19:33 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-06-07 06:46:22 +0000 ibcore: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen() The algorithm pre-allocates a cm_id since allocation cannot be done while holding the cm.lock spinlock, however it doesn't free it on one error path, leading to a memory leak. Linux commit: c14dfddbd869bf0c2bafb7ef260c41d9cebbcfec PR: 264248 Sponsored by: NVIDIA Networking (cherry picked from commit c4a415505311e30093b6d9ee0493427a66f2b0de) sys/ofed/drivers/infiniband/core/ib_cm.c | 1 + 1 file changed, 1 insertion(+)