From 387d76c0046b4fb6fbd8d70389b335661d099683 Mon Sep 17 00:00:00 2001 From: Junxian Huang Date: Wed, 23 Apr 2025 16:55:17 +0800 Subject: [PATCH 62/62] verbs: Assign ibv srq->pd when creating SRQ mainline inclusion from mainline-v56.0-65 commit bf1e427141fde2651bab4860e77a432bb7e26094 category: bugfix bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IC3X57 CVE: NA Reference: https://github.com/linux-rdma/rdma-core/pull/1599/commits/bf1e427141fde2651b... --------------------------------------------------------------------- Some providers need to access ibv_srq->pd during SRQ destruction, but it may not be assigned currently when using ibv_create_srq_ex(). This may lead to some SRQ-related resource leaks. Assign ibv_srq->pd when creating SRQ to ensure pd can be obtained correctly. Signed-off-by: Junxian Huang Signed-off-by: Xinghai Cen --- libibverbs/cmd_srq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libibverbs/cmd_srq.c b/libibverbs/cmd_srq.c index dfaaa6a..259ea0d 100644 --- a/libibverbs/cmd_srq.c +++ b/libibverbs/cmd_srq.c @@ -63,6 +63,7 @@ static int ibv_icmd_create_srq(struct ibv_pd *pd, struct verbs_srq *vsrq, struct verbs_xrcd *vxrcd = NULL; enum ibv_srq_type srq_type; + srq->pd = pd; srq->context = pd->context; pthread_mutex_init(&srq->mutex, NULL); pthread_cond_init(&srq->cond, NULL); -- 2.25.1