From patchwork Thu May 11 15:08:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Israel Rukshin X-Patchwork-Id: 9722015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0A2560364 for ; Thu, 11 May 2017 15:09:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9569528668 for ; Thu, 11 May 2017 15:09:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A3DA2867C; Thu, 11 May 2017 15:09:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 316DC28668 for ; Thu, 11 May 2017 15:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756398AbdEKPJ0 (ORCPT ); Thu, 11 May 2017 11:09:26 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:35109 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756389AbdEKPJ0 (ORCPT ); Thu, 11 May 2017 11:09:26 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from israelr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 11 May 2017 18:09:18 +0300 Received: from dev-r-vrt-007.mtr.labs.mlnx (dev-r-vrt-007.mtr.labs.mlnx [10.212.7.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v4BF9IuQ002288; Thu, 11 May 2017 18:09:18 +0300 From: Israel Rukshin To: linux-rdma Cc: Bart Van Assche , Max Gurtovoy , Israel Rukshin Subject: [PATCH] IB/srp: Fix NULL deref at srp_destroy_qp() Date: Thu, 11 May 2017 18:08:43 +0300 Message-Id: <1494515323-23869-1-git-send-email-israelr@mellanox.com> X-Mailer: git-send-email 1.8.4.3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If srp_init_qp() fails at srp_create_ch_ib() then ch->send_cq may be NULL. Calling directly to ib_destroy_qp() is sufficient because no work requests were posted on the created qp. Signed-off-by: Israel Rukshin Reviewed-by: Max Gurtovoy --- drivers/infiniband/ulp/srp/ib_srp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index def723a..4306285 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -575,7 +575,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch) return 0; err_qp: - srp_destroy_qp(ch, qp); + ib_destroy_qp(qp); err_send_cq: ib_free_cq(send_cq);