From patchwork Tue Sep 29 12:29:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Potnuri Bharat Teja X-Patchwork-Id: 7285571 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1817EBEEA4 for ; Tue, 29 Sep 2015 12:30:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48E25206C7 for ; Tue, 29 Sep 2015 12:30:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D765206A6 for ; Tue, 29 Sep 2015 12:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933698AbbI2MaL (ORCPT ); Tue, 29 Sep 2015 08:30:11 -0400 Received: from stargate.chelsio.com ([67.207.112.58]:19173 "EHLO stargate3.asicdesigners.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756317AbbI2MaI (ORCPT ); Tue, 29 Sep 2015 08:30:08 -0400 Received: from localhost ([10.193.186.242]) by stargate3.asicdesigners.com (8.13.8/8.13.8) with ESMTP id t8TCU07u005437; Tue, 29 Sep 2015 05:30:01 -0700 From: Bharat Potnuri To: arlin.r.davis@intel.com Cc: linux-rdma@vger.kernel.org, swise@opengridcomputing.com, nirranjan@chelsio.com, Bharat Potnuri Subject: [PATCH] dapl: Fix segfault while freeing qp Date: Tue, 29 Sep 2015 17:59:34 +0530 Message-Id: <1443529774-26431-1-git-send-email-bharat@chelsio.com> X-Mailer: git-send-email 2.5.3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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_