Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5112828pxb; Tue, 28 Sep 2021 10:46:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfHNvB/pY/PpoKdWju75hdPAaheXBE1VbaplrAuFaedpHjK/PReoLQ/s1Krurrcgzrx/Kg X-Received: by 2002:a17:902:c204:b0:13d:c6ef:7cf2 with SMTP id 4-20020a170902c20400b0013dc6ef7cf2mr6190375pll.33.1632851185413; Tue, 28 Sep 2021 10:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632851185; cv=none; d=google.com; s=arc-20160816; b=Bu3qKhxLlqgrrjk6EJ3blZDbQNlhl35xCrB4GYgJxQCVA3hpL62MfIkf3/ilZ/MBYk jy3kSqwBntaxdSz/aQO8XBXVB+0azdI9pYNN4jy26SNgpv9gyBqehOKqKySfmm8oVgdm ehvtPjl/MOWX5v1cEu9YUFQ8D5YiIrjQpHdApXBDTyeJpQTa9b2ravr3UxvZHxf+eOvF gV+Dv71MOGbM7RQSLR7GpQN4k68NSMswAPVwPPPwYJ2U4EUoxjfbvV/oT3/g8Q6snBEW m2oz1k+MgnDmQefpw9xgsSAtt3f51bid8A0HKlLsF2K/wFlVUPLKFr/GjAnwa+K10EoJ vJqg== 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=aZjQH7QMaSl5FVaqYf6XvxwPYWNnZykG+9zOEaj2ve8=; b=HqTgJIYwCQzbSSNdbcgHLuln2QpqFsEHbSkVn9DmV3TsHk12SViOsaM0MzfxMRRK1x nqPh0zculPQZ0XHwjZvA7Fc+gTphzQcylIlYw0xVXHhwLvWfZfAE8WZ6sIexSrWL+edD 9Jj3Fn5KmRe5DKSi8iMVnMnvzxY/V37B9DBEWfgwFjpDdfzCE7B3o/0GUcUbHEWSDI7m SW9+bqp6F/lshU4vgSq6mJ5FCmDTTJi8Kuxs5HSm4njF3X1+aDwO5HngHMzUGbM9Aq5F R85cnahYMgPd6m4hRYAqgzkOBFxQPab0Q6brfxW+aZEf/TaZa4gl8noeJ+0YjtnAm9BK 4Rtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ikPva56G; 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 v13si23832936ple.422.2021.09.28.10.46.06; Tue, 28 Sep 2021 10:46:25 -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=ikPva56G; 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 S241965AbhI1RqO (ORCPT + 99 others); Tue, 28 Sep 2021 13:46:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241404AbhI1RqI (ORCPT ); Tue, 28 Sep 2021 13:46:08 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73658C06161C; Tue, 28 Sep 2021 10:44:28 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id u18so93956332lfd.12; Tue, 28 Sep 2021 10:44:28 -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=aZjQH7QMaSl5FVaqYf6XvxwPYWNnZykG+9zOEaj2ve8=; b=ikPva56GfBzLVz9pfiLjNMzDQwJQ13fOS6PD+07irzd9UwvL09+1AvafRN/kRz7tfr m07+bSlrSOOWl+czXXBnR9T5Is0yfpPCg5awpeF2pvKGIHRl7OWfsWtJ0XnGgLOB5Bqz EpUgBtWailjmwVvqs/f/Frx03W8BPM6UUfEtFmVhRvzWrI937buBDjfl3WzMBNJ64YBD cMdFjBYoad6Dq1SOLHGVS5Lo3L16+vYbHl1HlrLmwUM9+8VZA9lR7KTlZHBfY29VNs0c yUMxeLFPA2IlKhJLe9jOAN51Sw7C5LQUQfx7bS4hQ6NsHejJeyacccnlFVDoFc1EsdnW 4fAw== 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=aZjQH7QMaSl5FVaqYf6XvxwPYWNnZykG+9zOEaj2ve8=; b=KDW4JKLj4r2DcvoJJbVFjUYjENSh7c4S6DPsVpo8v45TyJeyZ5pK7SUyXav2qvMxZZ XTwDKlLVp8fl/Uc53Sj35tB9suHc7ZjneuCOO+7n8XoqLerBJz2SpN0Fjji50DDHWBFp vVu7dknUvkf878oTwpu450ZWl2jC+5HY4Rx91TlZNBVnWjrWkJ7AnlGTeWDaKxwcnVSQ oTDoVe/UkViTUSalgENcNcyiGL8hBAlbTJzMjiEZEaCN7HoR6NRXoArlZJx3cOvhZouF /JqcW59elMpYMlkTpT7pp67KEnh5UMEj7EivgPZn7gqPIu0PutO+jtjTWtpqsI1tdQ7I k4tA== X-Gm-Message-State: AOAM533rsA43pN6Cq+7q0WevA6XfP4CIoSpDxUwPa5z9uwqSjDuRT03B zMaTKr+BQmKDq1jlW5I23htRgjSW1lw= X-Received: by 2002:ac2:57cb:: with SMTP id k11mr6558368lfo.70.1632851065421; Tue, 28 Sep 2021 10:44:25 -0700 (PDT) Received: from kari-VirtualBox (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l9sm1988435lfh.36.2021.09.28.10.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 10:44:25 -0700 (PDT) Date: Tue, 28 Sep 2021 20:44:23 +0300 From: Kari Argillander To: Konstantin Komarov Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 1/3] fs/ntfs3: Fix memory leak if fill_super failed Message-ID: <20210928174423.z7a6chrjmmyezlsp@kari-VirtualBox> References: <5ee2a090-1709-5ca0-1e78-8db1f3ded973@paragon-software.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ee2a090-1709-5ca0-1e78-8db1f3ded973@paragon-software.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 28, 2021 at 08:17:29PM +0300, Konstantin Komarov wrote: > Restore fc->s_fs_info to free memory allocated in ntfs_init_fs_context. > > Signed-off-by: Konstantin Komarov > --- > fs/ntfs3/super.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 800897777eb0..aff90f70e7bf 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -1242,6 +1242,10 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) > return 0; > out: > iput(inode); > + > + /* Restore fc->s_fs_info to free memory allocated in ntfs_init_fs_context. */ > + fc->s_fs_info = sbi; > + Nack. fc->s_fs_info is already pointing to sbi. We null this just before we exit so it is impossible to be anything else in failure case. fc->fs_private = NULL; fc->s_fs_info = NULL; return 0; out: iput(inode); > return err; > } > > -- > 2.33.0 > >