Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1340703pxb; Fri, 10 Sep 2021 03:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznHzPSyxPgLqE554NNvIFEYR0OrNS5BCL11ekaGBrHMMyLW+sKVPAsT4JqrZMOPYByp4fd X-Received: by 2002:a05:6e02:10d0:: with SMTP id s16mr5839650ilj.275.1631271077941; Fri, 10 Sep 2021 03:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631271077; cv=none; d=google.com; s=arc-20160816; b=nJ6BsY+q1iRF2DP13hiYB71YjEPAVT0wyfLzA1WoBubOYA4qzzHcXNS5SNSE57m/qU 12dzj0o7UsQAFvO+QYeV4CsJMaIcgzZHdpzVmb2MaaYuVAiKQpc8KL7CNgRUugTg8T+B aFS9GQoKHvSd6nw610D056Am/xMk14FaDA2CmoGLHorZzc1486mkNiHrlIbZDXX3l/jD szshHuN1fq2dMMokf/9mBvYsN3UWNmHVMV99lWCWJhUcBkzor5VRcFv8SDHiZW0A7yB4 aFH/5XrRgzQsKVxEmpmiX3WomVjQxqkpAPS4BJtW4mWAI5E2xVcMeTYkwEKg7m+AfRCP B2gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eKzR9oqZtxb76e9ajCaeipteTFurfCH3JAineo6pIuM=; b=RA0vYgMk7YT5R0Nypu8fmwd36ma7bAf7Pl8nLr14J5lDmk4L5JZ56TdFildlGVYRyX tDYZNCN2W6VTJF6Zs2BmjNDOYXWzxXZuMvLYvaBHTksaF+b2gKquVkcJy+v3Fwh3HFAS JXR8wqZfzNXH8wZTBSuTrItdc82w1ET4EXloiHh5umLVexHXy4hQoLQk/uQGmaGFmgaU YdjYOUCDVgijkXhAFDMjOPllBQEs3t6ROd4uj5spVQivFoS++bKq+YrkXvSF7XjacWIA pFJRexUkSoXWuyiG1X/RRR8X0KunC+ENIYo4f7orriAmMmw5qn66bZVdNpOXB9JW4Cj6 PySA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VJ6fhld+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si5147083jan.99.2021.09.10.03.51.06; Fri, 10 Sep 2021 03:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VJ6fhld+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232460AbhIJKvd (ORCPT + 99 others); Fri, 10 Sep 2021 06:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbhIJKvd (ORCPT ); Fri, 10 Sep 2021 06:51:33 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37CAAC061574; Fri, 10 Sep 2021 03:50:22 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id s10so3143806lfr.11; Fri, 10 Sep 2021 03:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eKzR9oqZtxb76e9ajCaeipteTFurfCH3JAineo6pIuM=; b=VJ6fhld+oMLvdqeJZJ4x+KXrdwelIlyHC6Y1HU9DXoN9zQagksco0D3jSyu7brffEL qqGLIVxK139LXLhvwHlPB1YD+Nbq498Z2BKU/0H/bRQhy9FTzxSgmzy2peIstkWmnzgC rwUJKpqiJGsXEFobGoqVT4BaCMggfJ2klvjAtlPINHqus8eM55kWkJWem7udMndHxh8b eryJxzjyTnrndyQlik14jaD6xoaWMAEfNfmZWTzNb2VMC095MfY8Aln8//ex/25LWd6x z8I9rVdeX7kpehWcLRys9/Z4c33/G3zs0TvBAfpvIgDbpsY6KWE9mYd4ogVLIUaXhX+D 896Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eKzR9oqZtxb76e9ajCaeipteTFurfCH3JAineo6pIuM=; b=Sr3Mu5fHRmn+RJO+4am3X6/BCl+JO1CeVjBBvJDC8J30SPRAnQce0Y4GVZqSbwtzNC LMI5zkuwiWN0zdlX1konFU+B++WpZEZWxSdl7ur3obcXm1K+cpDIvqXeG8XyeqYt41kY XFl8icXBH6o6qUPw1j0BAVVaAXPcxj+hSIGAG3EQt0XtOaZ7FDWWWggvRM1l+BGpgKo/ SaDo4Y8AsFQzJaB93aIP0k1/cbUPq05rQWi3yYjvv74IibtXB24hNTcKv8Kmojz2UI+o VwLhgMn4Y8o3MZDuN58pQ1luX2XOJkK+5IXHqQFQopMQTIr5E5pQUeG1LZuJY6XO0Bov A+pw== X-Gm-Message-State: AOAM530Q1UtsHAYAUp3EP+gsYdZpzSVuyqQPRgGn5oUy+MzAqgowRNqZ NH2kGABGEUMJ+/0EsWsuWPI= X-Received: by 2002:a05:6512:2202:: with SMTP id h2mr3411408lfu.494.1631271020592; Fri, 10 Sep 2021 03:50:20 -0700 (PDT) Received: from kari-VirtualBox ([31.132.12.44]) by smtp.gmail.com with ESMTPSA id z16sm535665lfu.110.2021.09.10.03.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 03:50:20 -0700 (PDT) Date: Fri, 10 Sep 2021 13:50:18 +0300 From: Kari Argillander To: Colin King Cc: Konstantin Komarov , ntfs3@lists.linux.dev, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] fs/ntfs3: Fix a memory leak on object opts Message-ID: <20210910105018.asvmzihjdqeqm25v@kari-VirtualBox> References: <20210910100202.29254-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210910100202.29254-1-colin.king@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 11:02:02AM +0100, Colin King wrote: > From: Colin Ian King > > Currently a failed allocation on sbi->upcase will cause an exit via > the label free_sbi causing a memory leak on object opts. Fix this by > re-ordering the exit paths free_opts and free_sbi so that kfree's occur > in the reverse allocation order. > > Addresses-Coverity: ("Resource leak") > Fixes: 27fac77707a1 ("fs/ntfs3: Init spi more in init_fs_context than fill_super") > Signed-off-by: Colin Ian King > --- Thanks Colin. Reviewed-by: Kari Argillander > fs/ntfs3/super.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 3cba0b5e7ac7..69f23db0d727 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -1450,10 +1450,10 @@ static int ntfs_init_fs_context(struct fs_context *fc) > fc->ops = &ntfs_context_ops; > > return 0; > -free_opts: > - kfree(opts); > free_sbi: > kfree(sbi); > +free_opts: > + kfree(opts); > return -ENOMEM; > } > > -- > 2.32.0 >