From patchwork Fri Jun 21 13:32:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Derr X-Patchwork-Id: 2763011 Return-Path: X-Original-To: patchwork-v9fs-devel@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 CD735C0AB1 for ; Fri, 21 Jun 2013 14:05:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77B9A20210 for ; Fri, 21 Jun 2013 14:05:16 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0DCE920200 for ; Fri, 21 Jun 2013 14:05:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Uq1xc-0002gu-BT; Fri, 21 Jun 2013 14:05:08 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Uq1xa-0002gD-Df for v9fs-developer@lists.sourceforge.net; Fri, 21 Jun 2013 14:05:06 +0000 X-ACL-Warn: Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by sog-mx-3.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1Uq1xT-0003Uh-6X for v9fs-developer@lists.sourceforge.net; Fri, 21 Jun 2013 14:05:06 +0000 Received: from atlas.frec.bull.fr (atlas.frec.bull.fr [129.183.91.13]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id A4FE86F5F4; Fri, 21 Jun 2013 15:33:03 +0200 (CEST) Received: by atlas.frec.bull.fr (Postfix, from userid 15269) id 4A9BB38004C; Fri, 21 Jun 2013 15:33:03 +0200 (CEST) From: Simon Derr To: v9fs-developer@lists.sourceforge.net Date: Fri, 21 Jun 2013 15:32:40 +0200 Message-Id: <1371821563-5784-8-git-send-email-simon.derr@bull.net> X-Mailer: git-send-email 1.7.2.2 In-Reply-To: <1371821563-5784-1-git-send-email-simon.derr@bull.net> References: <1371821563-5784-1-git-send-email-simon.derr@bull.net> X-Spam-Score: -1.5 (-) X-Headers-End: 1Uq1xT-0003Uh-6X Cc: simon.derr@bull.net Subject: [V9fs-developer] [PATCH 07/10] 9P/RDMA: Do not free req->rc in error handling in rdma_request() X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 rdma_request() should never be in charge of freeing rc. When an error occurs: * Either the rc buffer has been recv_post()'ed. then kfree()'ing it certainly is a bad idea. * Or is has not, and in that case req->rc still points to it, hence it needs not be freed. Signed-off-by: Simon Derr --- net/9p/trans_rdma.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index ad8dc33..1bd4c71 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -447,7 +447,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) err = post_recv(client, rpl_context); if (err) { p9_debug(P9_DEBUG_FCALL, "POST RECV failed\n"); - goto err_free1; + goto err_free; } /* remove posted receive buffer from request structure */ @@ -457,7 +457,7 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) c = kmalloc(sizeof *c, GFP_NOFS); if (!c) { err = -ENOMEM; - goto err_free1; + goto err_free; } c->req = req; @@ -486,13 +486,10 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) error: kfree(c); - kfree(rpl_context->rc); kfree(rpl_context); p9_debug(P9_DEBUG_ERROR, "EIO\n"); return -EIO; - err_free1: - kfree(rpl_context->rc); - err_free2: + err_free: kfree(rpl_context); err_close: spin_lock_irqsave(&rdma->req_lock, flags);