From patchwork Wed May 25 05:09:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 9134729 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 211BF60221 for ; Wed, 25 May 2016 05:09:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F9432810D for ; Wed, 25 May 2016 05:09:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04A4D28164; Wed, 25 May 2016 05:09:50 +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 A4DC82810D for ; Wed, 25 May 2016 05:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754020AbcEYFJs (ORCPT ); Wed, 25 May 2016 01:09:48 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33805 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750840AbcEYFJr (ORCPT ); Wed, 25 May 2016 01:09:47 -0400 Received: by mail-pa0-f45.google.com with SMTP id qo8so13897860pab.1 for ; Tue, 24 May 2016 22:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=primarydata-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rcWT3/CIZxlxoofIVRY4Tb8w2aRdxSHzn43m5/+Y7YY=; b=1QyOzc1zYVCEiRO1a0IAdzxRezOQRB/KNymixhJ1IwObsInogkUUMdrhF1Nm0jdeg2 ViYW9sOPZ1uVv+IS3iwqk+kmrR4kN1XE88aprmYw61gCG7dyBiKHA7FE+8FGldqwFOOS 1Y7lkyIcCxZsGUzfBAie1qa7ky6P3rmwoYRpJpHbKZqq3+orkJ2dPZGOpxZvoXv0rPEQ +2k4oaTtb1bWd4PND+PQii0Ca1cMWUb2MFGfZ8jSf3qrock9un1PMTZ6hJgsNMR2dnai eEGnuG49sXvec05bS6sxAR/OltBs9I0iS4YvoCZVVc+h8CFdTCPwWfvro6kBXk4Cbi1/ iumw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rcWT3/CIZxlxoofIVRY4Tb8w2aRdxSHzn43m5/+Y7YY=; b=DhglI6o3qVtNIfnCUSwsFxhrtB6YoZ/VNCm2Bcsg3nMBM8CUT1O80RcDy5WGCNtrY/ 62BEUL6ADnLzuQj9DRFIeddHgUz+Qm5dAMcdNX1oOEDpkBza7aDJ/k09pFMdOwz332SN DvQx7u6/lz9BIRvV4ij22cYAPe5+opnRfNy18TQhzTkbJkO5/zHEW4GnHdFmnL9pJTV/ bc/a0VRU7Phe2PPF8rvCsIinrA3NmUctFv5eUckJ6o4tnCU9WpMJ+J07DaO/LJ/GJxzh /NuqE9w5kctNg9MXwpRTvmpvmTDeWau8THtFgKN4vuyKWrllU92S6+Bh7H90yTueGWlj TyyA== X-Gm-Message-State: ALyK8tINzF98EdV35biEY2G3nuYbgRyQaKNllRoGvv/hG6Bq+M641eNnK6AkgrmL7NUwm3qp X-Received: by 10.66.141.76 with SMTP id rm12mr2799010pab.129.1464152986662; Tue, 24 May 2016 22:09:46 -0700 (PDT) Received: from jhereg.localdomain (c-50-131-226-197.hsd1.ca.comcast.net. [50.131.226.197]) by smtp.gmail.com with ESMTPSA id s8sm9035341pav.39.2016.05.24.22.09.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2016 22:09:46 -0700 (PDT) From: Tom Haynes X-Google-Original-From: Tom Haynes To: "J. Bruce Fields" Cc: Linux NFS Mailing list , Christoph Hellwig Subject: [PATCH 2/4] nfsd: Can leak pnfs_block_extent on error Date: Tue, 24 May 2016 22:09:37 -0700 Message-Id: <1464152979-103988-3-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1464152979-103988-1-git-send-email-loghyr@primarydata.com> References: <1464152979-103988-1-git-send-email-loghyr@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tom Haynes Reviewed-by: Jeff Layton --- fs/nfsd/blocklayout.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index 248adb6..9a195f1 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c @@ -23,7 +23,7 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, struct nfsd4_layout_seg *seg = &args->lg_seg; struct super_block *sb = inode->i_sb; u32 block_size = (1 << inode->i_blkbits); - struct pnfs_block_extent *bex; + struct pnfs_block_extent *bex = NULL; struct iomap iomap; u32 device_generation = 0; int error; @@ -105,9 +105,11 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, return 0; out_error: + kfree(bex); seg->length = 0; return nfserrno(error); out_layoutunavailable: + kfree(bex); seg->length = 0; return nfserr_layoutunavailable; }