From patchwork Fri Nov 18 14:36:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 9436669 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 715EF60237 for ; Fri, 18 Nov 2016 14:47:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C6B629908 for ; Fri, 18 Nov 2016 14:47:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6182E29911; Fri, 18 Nov 2016 14:47:23 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 574C429908 for ; Fri, 18 Nov 2016 14:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753087AbcKROrU (ORCPT ); Fri, 18 Nov 2016 09:47:20 -0500 Received: from esa2.dell-outbound.iphmx.com ([68.232.149.220]:34012 "EHLO esa2.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753405AbcKROrR (ORCPT ); Fri, 18 Nov 2016 09:47:17 -0500 X-Greylist: delayed 571 seconds by postgrey-1.27 at vger.kernel.org; Fri, 18 Nov 2016 09:47:16 EST DomainKey-Signature: s=smtpout; d=dell.com; c=simple; q=dns; h=Received:Received:Received:X-DKIM:Received:Received:From: To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:X-RSA-Classifications:X-Sentrion-Hostname; b=yB/2v+xHLYGE+BcR56b6bXQOsrJZC0wcMvDnpM+4QZ5l6GA/WTXeVtRo xWPAfvNttEObFJutasAjdRzgVUEK2+yX77n1zggHw9phecNrC3KIXELmx qj0PxAVWmDXhd2ZBrdzv0WZMZHbChxG2m6L53gjBFi10LqW4I2o6pcTae c=; DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1479480436; x=1511016436; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=+febrOQqtO1k8HuFyXO3yN6GarL15km2CRRXaPPTyu0=; b=SKIzkq6XQ1P3dJBaRm8nNtWGhTRC18VMf3K24/c9786Wg5aGNql3LuF8 GugtIOKOy826uOKDekVrKqJHSGDNIoQIr3qwp3UswRI3XnjlhR8cnkkIA g+yI7vq6k8JVY1PHXEpkR2utOqBx5apGfCqGLdzxkqqREMNz8PLEwuvoP k=; Received: from esa3.dell-outbound2.iphmx.com ([68.232.154.63]) by esa2.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2016 08:37:47 -0600 Received: from mailuogwhop.emc.com ([168.159.213.141]) by esa3.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2016 20:37:47 +0600 Received: from maildlpprd01.lss.emc.com (maildlpprd01.lss.emc.com [10.253.24.33]) by mailuogwprd04.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id uAIEbjxs025674 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 18 Nov 2016 09:37:45 -0500 X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd04.lss.emc.com uAIEbjxs025674 Received: from mailapphubprd02.lss.emc.com (emcmail.lss.emc.com [10.253.24.52]) by maildlpprd01.lss.emc.com (RSA Interceptor); Fri, 18 Nov 2016 09:37:19 -0500 Received: from hopcyc-boyera-1.corp.emc.com (hopcyc-boyera-1.cec.lab.emc.com [10.244.91.191]) by mailapphubprd02.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id uAIEbBSw021870; Fri, 18 Nov 2016 09:37:25 -0500 From: Andrew Boyer To: monis@mellanox.com, linux-rdma@vger.kernel.org Cc: Andrew Boyer Subject: [PATCH 7/7] IB/rxe: Fix ref leaks in duplicate_request() and rxe_create_qp() Date: Fri, 18 Nov 2016 09:36:49 -0500 Message-Id: <1479479809-10798-7-git-send-email-andrew.boyer@dell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1479479809-10798-1-git-send-email-andrew.boyer@dell.com> References: <1479479809-10798-1-git-send-email-andrew.boyer@dell.com> X-RSA-Classifications: public X-Sentrion-Hostname: mailuogwprd04.lss.emc.com 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 In duplicate_request(), a ref was added after the call to skb_clone(). In rxe_create_qp(), the udata->inlen error path needs to clean up the ref added by rxe_alloc(). Signed-off-by: Andrew Boyer Acked-by: Moni Shoua --- drivers/infiniband/sw/rxe/rxe_resp.c | 1 + drivers/infiniband/sw/rxe/rxe_verbs.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index a5e9ce3..8643797 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -1145,6 +1145,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp, pkt, skb_copy); if (rc) { pr_err("Failed resending result. This flow is not handled - skb ignored\n"); + rxe_drop_ref(qp); kfree_skb(skb_copy); rc = RESPST_CLEANUP; goto out; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index de39b0a..071430c 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -564,7 +564,7 @@ static struct ib_qp *rxe_create_qp(struct ib_pd *ibpd, if (udata) { if (udata->inlen) { err = -EINVAL; - goto err1; + goto err2; } qp->is_user = 1; } @@ -573,12 +573,13 @@ static struct ib_qp *rxe_create_qp(struct ib_pd *ibpd, err = rxe_qp_from_init(rxe, qp, pd, init, udata, ibpd); if (err) - goto err2; + goto err3; return &qp->ibqp; -err2: +err3: rxe_drop_index(qp); +err2: rxe_drop_ref(qp); err1: return ERR_PTR(err);