From: Sean Hefty Date: Mon, 21 May 2012 05:41:38 +0000 (-0700) Subject: librdmacm: Check that send and recv CQs are different before destroying X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=a3796c012704c7f02811c49538d65dc24c2d1cb3;p=~shefty%2Flibrdmacm.git librdmacm: Check that send and recv CQs are different before destroying ucma_destroy_cqs() destroys both the send and recv CQs if they are non-null. If the two CQs are actually the same one, this results in a crash when trying to destroy the second CQ. Check that the CQs are different before destroying the second CQ. This fixes a crash when using rsockets, which sets the send and recv CQs to the same CQ. Signed-off-by: Sean Hefty --- diff --git a/src/cma.c b/src/cma.c index c32803d5..9cd34cf5 100755 --- a/src/cma.c +++ b/src/cma.c @@ -1096,10 +1096,10 @@ static void ucma_destroy_cqs(struct rdma_cm_id *id) if (id->recv_cq_channel) ibv_destroy_comp_channel(id->recv_cq_channel); - if (id->send_cq) + if (id->send_cq && (id->send_cq != id->recv_cq)) ibv_destroy_cq(id->send_cq); - if (id->send_cq_channel) + if (id->send_cq_channel && (id->send_cq_channel != id->recv_cq_channel)) ibv_destroy_comp_channel(id->send_cq_channel); }