* [PATCH] dapl: Fix segfault while freeing qp
@ 2015-09-29 12:29 Bharat Potnuri
[not found] ` <1443529774-26431-1-git-send-email-bharat-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Bharat Potnuri @ 2015-09-29 12:29 UTC (permalink / raw)
To: arlin.r.davis-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
nirranjan-ut6Up61K2wZBDgjK7y7TUQ, Bharat Potnuri
In function dapls_ib_qp_free(), pointers qp and cm_ptr->cm_id->qp are
pointing to the same qp structure, initialized in function
dapls_ib_qp_alloc(). The memory pointed by these pointers are freed
twice in function dapls_ib_qp_free(), using rdma_destroy_qp() for the
case _OPENIB_CMA defined and then further using ibv_destroy_qp(),
causing a segmentation fault while freeing the qp. Therefore assigned
NULL value to qp to avoid freeing illegal memory.
Fixes: 7ff4f840bf11 ("common: add CM-EP linking to support mutiple CM's
and proper protection during destruction")
Signed-off-by: Bharat Potnuri <bharat-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
---
dapl/openib_common/qp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dapl/openib_common/qp.c b/dapl/openib_common/qp.c
index 527fc1d4c46b..01f91ca2bd83 100644
--- a/dapl/openib_common/qp.c
+++ b/dapl/openib_common/qp.c
@@ -397,6 +397,7 @@ DAT_RETURN dapls_ib_qp_free(IN DAPL_IA * ia_ptr, IN DAPL_EP * ep_ptr)
#ifdef _OPENIB_CMA_
rdma_destroy_qp(cm_ptr->cm_id);
cm_ptr->cm_id->qp = NULL;
+ qp = NULL;
#endif
#ifdef _OPENIB_MCM_
--
2.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] dapl: Fix segfault while freeing qp
[not found] ` <1443529774-26431-1-git-send-email-bharat-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
@ 2015-09-29 15:56 ` Davis, Arlin R
0 siblings, 0 replies; 2+ messages in thread
From: Davis, Arlin R @ 2015-09-29 15:56 UTC (permalink / raw)
To: Bharat Potnuri
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
nirranjan-ut6Up61K2wZBDgjK7y7TUQ
Thanks, applied.
> -----Original Message-----
> From: Bharat Potnuri [mailto:bharat-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org]
> Sent: Tuesday, September 29, 2015 5:30 AM
> To: Davis, Arlin R
> Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org;
> nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org; Bharat Potnuri
> Subject: [PATCH] dapl: Fix segfault while freeing qp
>
> In function dapls_ib_qp_free(), pointers qp and cm_ptr->cm_id->qp are
> pointing to the same qp structure, initialized in function dapls_ib_qp_alloc().
> The memory pointed by these pointers are freed twice in function
> dapls_ib_qp_free(), using rdma_destroy_qp() for the case _OPENIB_CMA
> defined and then further using ibv_destroy_qp(), causing a segmentation fault
> while freeing the qp. Therefore assigned NULL value to qp to avoid freeing
> illegal memory.
>
> Fixes: 7ff4f840bf11 ("common: add CM-EP linking to support mutiple CM's and
> proper protection during destruction")
>
> Signed-off-by: Bharat Potnuri <bharat-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
> ---
> dapl/openib_common/qp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/dapl/openib_common/qp.c b/dapl/openib_common/qp.c index
> 527fc1d4c46b..01f91ca2bd83 100644
> --- a/dapl/openib_common/qp.c
> +++ b/dapl/openib_common/qp.c
> @@ -397,6 +397,7 @@ DAT_RETURN dapls_ib_qp_free(IN DAPL_IA * ia_ptr,
> IN DAPL_EP * ep_ptr) #ifdef _OPENIB_CMA_
> rdma_destroy_qp(cm_ptr->cm_id);
> cm_ptr->cm_id->qp = NULL;
> + qp = NULL;
> #endif
>
> #ifdef _OPENIB_MCM_
> --
> 2.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-29 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 12:29 [PATCH] dapl: Fix segfault while freeing qp Bharat Potnuri
[not found] ` <1443529774-26431-1-git-send-email-bharat-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2015-09-29 15:56 ` Davis, Arlin R
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).