Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2002618pxb; Mon, 20 Sep 2021 09:56:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1Ruw8HNtTBBSqq+nT155x5OMPENTZCGyG+NYptvRmmS+4GO1MAiWOmlef8nEwIgXk1CxM X-Received: by 2002:a02:1dc9:: with SMTP id 192mr20589032jaj.92.1632156989772; Mon, 20 Sep 2021 09:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632156989; cv=none; d=google.com; s=arc-20160816; b=wRwVpaiyUhcftRqGVVT6omFNL3Qh8GNZZakE9CtXzfphdNA0PhWCmesROmUtnLwuIv Ch7+H6/b+yVIzLEBVYbEVat9lPCghHOZXKxG52PQnepM1eZwyVgOwfQfSLeKltgf6qVi BOzQnOHexLzm2Lf8RIMBBd4MBw5z6NC+yPh5PukO9qleeOUW1fPyXTN4omFsFkHDLbvA yMM+ysxSBlDQ40gg6l53/N0GlYvxatYXeG1WlEXf3m1eqQdh9xCtpCk1YdIleMr6X/Ii AHkusjeGJTKNCDva2VU/+6AsNeAfZNMRe9xx2eaAtJCrAsLm3GHD2gMKV4NUkzPAr6wZ llSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wuDdTyPetTEzRQ4y4eTAWgHy8+xrc7SOdwkMIA0RNpc=; b=ddkeaNvFIZrCyLJoELeh3Hkjl1/pE4lEZZYB5X+pRzykdqaSd2xaLpNqGsK4lKYxhk oGG2NcSjp5MypaoJqH3BDowILBJYNBeQDrd7NI3wgz0QsArOC6ciERAn5iP3RIUVH0EX 3xRZj5qqaocGTxDgVZsFjuBhY6ED/yXtCtC8qgqEzb3kgUCtzrQsPs5RBPq8pibQbq6m U6ngOkQtvGP03S6NQdQ4igQLKQjBhBIoMd1V2vfaI9uZiJEaf7NcADTudEcmgCO0cjGo yNtJlyh1viFduUvSrFytCquI7Ce4rRJKNxqPYl5yeWLUdYtJghlDlPcULbFtj1MDXdRN K8IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=KkfmucBW; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o37si5253612jac.23.2021.09.20.09.56.14; Mon, 20 Sep 2021 09:56:29 -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=@paragon-software.com header.s=mail header.b=KkfmucBW; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239378AbhITQQE (ORCPT + 99 others); Mon, 20 Sep 2021 12:16:04 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:59239 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242762AbhITQOZ (ORCPT ); Mon, 20 Sep 2021 12:14:25 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id 4AF94821F6; Mon, 20 Sep 2021 19:12:57 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1632154377; bh=wuDdTyPetTEzRQ4y4eTAWgHy8+xrc7SOdwkMIA0RNpc=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=KkfmucBWdo47N89nCE+N2ZIQxvFYljf3UyWsP00tn5R0ZkpJlTHXxn764UBtfm5J2 XkPkukSzsgQEquKzAgerIswmFGs+4lstadNtgkYK1ZmjdfeCITjP7ejhHggPRhcrG4 tB+t2RzKsHfaV2rG0LgOu0xZ5g8HFWcXpa/P6hY8= Received: from [192.168.211.150] (192.168.211.150) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 20 Sep 2021 19:12:56 +0300 Message-ID: <2692afd4-f263-838a-a80e-e6f740d44f36@paragon-software.com> Date: Mon, 20 Sep 2021 19:12:56 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH][next] fs/ntfs3: Fix a memory leak on object opts Content-Language: en-US To: Kari Argillander , Colin King CC: , , References: <20210910100202.29254-1-colin.king@canonical.com> <20210910105018.asvmzihjdqeqm25v@kari-VirtualBox> From: Konstantin Komarov In-Reply-To: <20210910105018.asvmzihjdqeqm25v@kari-VirtualBox> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.150] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10.09.2021 13:50, Kari Argillander wrote: > 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 >> Hi, Colin, Kari! Thanks for work - applied!