From patchwork Fri Dec 20 20:26:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Upinder Malhi (umalhi)" X-Patchwork-Id: 3391661 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0A82CC0D4A for ; Fri, 20 Dec 2013 20:27:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1399420704 for ; Fri, 20 Dec 2013 20:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3FCED20666 for ; Fri, 20 Dec 2013 20:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753678Ab3LTU1M (ORCPT ); Fri, 20 Dec 2013 15:27:12 -0500 Received: from mtv-iport-1.cisco.com ([173.36.130.12]:18422 "EHLO mtv-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752313Ab3LTU1K (ORCPT ); Fri, 20 Dec 2013 15:27:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1091; q=dns/txt; s=iport; t=1387571230; x=1388780830; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=h6v3OSi+a0fw9I71QD3DmgJ8cSbZ9Snj7SoiZV4e0to=; b=NTOo8N29wuI5jES6O2aK85ddo+ib2Cv2Ppu/2CRe8QU5anVlCC+n9+Tx wrEhEwtg+FtX/GdVCX0kyz0Wu6F3PeHMykzaZH8wi+Ub6jvay0wnbGPGa SgcG82SmynmqQH6HRJGLeePdvqd3qEXje5S+dsLZifYo1m4cZV8ByV3Iw s=; X-IronPort-AV: E=Sophos;i="4.95,523,1384300800"; d="scan'208";a="97830921" Received: from mtv-core-2.cisco.com ([171.68.58.7]) by mtv-iport-1.cisco.com with ESMTP; 20 Dec 2013 20:27:10 +0000 Received: from sjc-savbu-bld03.cisco.com (sjc-savbu-bld03.cisco.com [171.71.188.58]) by mtv-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id rBKKR9GU028548; Fri, 20 Dec 2013 20:27:10 GMT Received: by sjc-savbu-bld03.cisco.com (Postfix, from userid 246720) id E2AD33F4FD; Fri, 20 Dec 2013 12:27:09 -0800 (PST) From: Upinder Malhi To: linux-rdma@vger.kernel.org, roland@kernel.org Cc: Upinder Malhi Subject: [PATCH for-next 10/15] IB/usnic: Fix accounting of qp_grp_ref_cnt Date: Fri, 20 Dec 2013 12:26:41 -0800 Message-Id: <1387571206-8043-11-git-send-email-umalhi@cisco.com> X-Mailer: git-send-email 1.8.0-rc0 In-Reply-To: <1387571206-8043-1-git-send-email-umalhi@cisco.com> References: <1387571206-8043-1-git-send-email-umalhi@cisco.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-15.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 vf->qp_grp_ref_cnt is incorrectly incremented if usnic_uiom_attach_dev_to_pd fails; vf->pd is also erroneously populated in this same failure path. Signed-off-by: Upinder Malhi --- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 1.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c index 788f47a..0daf7e9 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c @@ -395,15 +395,16 @@ static int qp_grp_and_vf_bind(struct usnic_ib_vf *vf, WARN_ON(!spin_is_locked(&vf->lock)); pdev = usnic_vnic_get_pdev(vf->vnic); - if (vf->qp_grp_ref_cnt++ == 0) { - vf->pd = pd; + if (vf->qp_grp_ref_cnt == 0) { err = usnic_uiom_attach_dev_to_pd(pd->umem_pd, &pdev->dev); if (err) { usnic_err("Failed to attach %s to domain\n", pci_name(pdev)); return err; } + vf->pd = pd; } + vf->qp_grp_ref_cnt++; WARN_ON(vf->pd != pd); qp_grp->vf = vf;