From patchwork Sat May 30 06:12:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 6512361 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C0169F1CC for ; Sat, 30 May 2015 06:18:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98755207AD for ; Sat, 30 May 2015 06:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DB2720709 for ; Sat, 30 May 2015 06:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752800AbbE3GSK (ORCPT ); Sat, 30 May 2015 02:18:10 -0400 Received: from na3sys010aog114.obsmtp.com ([74.125.245.96]:50939 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751998AbbE3GSJ (ORCPT ); Sat, 30 May 2015 02:18:09 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]) (using TLSv1) by na3sys010aob114.postini.com ([74.125.244.12]) with SMTP ID DSNKVWlWIOKPrF8m0p7QxHtf0LtOQffj9r5j@postini.com; Fri, 29 May 2015 23:18:09 PDT Received: by iepj10 with SMTP id j10so77416723iep.3 for ; Fri, 29 May 2015 23:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=sender:from:to:cc:subject:date:message-id; bh=PmOHObpHDROI1d3CN3LXcUh+QS7ntyI7XKhhlTsoQ04=; b=ci/OblD/BD83T0aSNJA4E8QCJVoqSrd6mE5SgiqWS+y7f9I3LG3Nh0tCkmN76X7Za8 2YnAggRmWa+uwoO02qz4sadSl7ux7CkM0qUcuOZ+IhDcsIrQmmVOvK00rAxIZf08a/px 09g24v37srpScL0IfqtwOJF/DBpCQG4NIMZf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=PmOHObpHDROI1d3CN3LXcUh+QS7ntyI7XKhhlTsoQ04=; b=LJfwlETLtRMq70C5xmt0/3GS2MFid3NITMTIop6FjB4Gu+M5zdY8bM8UlvSXzR7YRg GDumID75D2MpqspJW3GMjLyGiLmaVtvcBl/2FsbivAik4YYklJvAttzo0cxAtH5OQNMU 2GH05A6RrBNwpw+Q3klPK2jDlDr3KJf+PyVy/Vn2JWkPlLl7t8Wo/VxFppNkiQwBuPj8 hYM+0wBegckTveZj56seg+zfrHRRw2cjgJ9o4uSvfg4EBZRxL8WErvzc66OeE6Kyhvoq 9oRV+bYCsKwzzrb0otflhL0DyL8WcSLYdM8h1fWrBS4IBtgheTP7gylj1NZq3GhVNaf7 uvow== X-Received: by 10.107.150.73 with SMTP id y70mr14406446iod.21.1432966339514; Fri, 29 May 2015 23:12:19 -0700 (PDT) X-Gm-Message-State: ALoCoQmBxTJLvBC0yqIYbN0OJ3sPtLeQmJxSDZgyzMiiZYTJeb9RXA2IcTWq3g3zchtDCc3YrKifY6qmWfFaPxRF6zoy88m5dIbmbY8dhBWNqHIrXhivjrlV+zSELMm3naXEoN7P4k9vUV9REAVHxsMELfm5NuWKMQ== X-Received: by 10.107.150.73 with SMTP id y70mr14406440iod.21.1432966339436; Fri, 29 May 2015 23:12:19 -0700 (PDT) Received: from roland-t440p.purestorage.com (50-206-43-50-static.hfc.comcastbusiness.net. [50.206.43.50]) by mx.google.com with ESMTPSA id 7sm5809456iok.43.2015.05.29.23.12.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 May 2015 23:12:18 -0700 (PDT) From: Roland Dreier To: "Nicholas A. Bellinger" Cc: Doug Ledford , Sagi Grimberg , linux-rdma@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH 3/3] iser-target: Fix error path in isert_create_pi_ctx() Date: Fri, 29 May 2015 23:12:10 -0700 Message-Id: <1432966330-12230-1-git-send-email-roland@kernel.org> X-Mailer: git-send-email 2.1.4 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY 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 From: Roland Dreier We don't assign pi_ctx to desc->pi_ctx until we're certain to succeed in the function. That means the cleanup path should use the local pi_ctx variable, not desc->pi_ctx. This was detected by Coverity (CID 1260062). Signed-off-by: Roland Dreier Acked-by: Sagi Grimberg --- drivers/infiniband/ulp/isert/ib_isert.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 327529ee85eb..3f40319a55da 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -547,11 +547,11 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc, return 0; err_prot_mr: - ib_dereg_mr(desc->pi_ctx->prot_mr); + ib_dereg_mr(pi_ctx->prot_mr); err_prot_frpl: - ib_free_fast_reg_page_list(desc->pi_ctx->prot_frpl); + ib_free_fast_reg_page_list(pi_ctx->prot_frpl); err_pi_ctx: - kfree(desc->pi_ctx); + kfree(pi_ctx); return ret; }