From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Kari Argillander <kari.argillander@gmail.com>
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
Date: Wed, 29 Sep 2021 19:55:14 +0300 [thread overview]
Message-ID: <9b37cc1a-2951-77fa-9932-6052555ceca9@paragon-software.com> (raw)
In-Reply-To: <20210928174423.z7a6chrjmmyezlsp@kari-VirtualBox>
On 28.09.2021 20:44, Kari Argillander wrote:
> 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 <almaz.alexandrovich@paragon-software.com>
>> ---
>> 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.
>
We have seen memory leak once, but looking at the code of function
I can't point where it was caused. Will try to reproduce again.
For now will commit only
"Reject mount if boot's cluster size < media sector size" and
"Refactoring of ntfs_init_from_boot".
> fc->fs_private = NULL;
> fc->s_fs_info = NULL;
>
> return 0;
> out:
> iput(inode);
>
>> return err;
>> }
>>
>> --
>> 2.33.0
>>
>>
next prev parent reply other threads:[~2021-09-29 16:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 17:16 [PATCH v2 0/3] fs/ntfs3: Refactoring of super.c Konstantin Komarov
2021-09-28 17:17 ` [PATCH v2 1/3] fs/ntfs3: Fix memory leak if fill_super failed Konstantin Komarov
2021-09-28 17:44 ` Kari Argillander
2021-09-29 16:55 ` Konstantin Komarov [this message]
2021-09-28 17:18 ` [PATCH v2 2/3] fs/ntfs3: Reject mount if boot's cluster size < media sector size Konstantin Komarov
2021-09-28 18:03 ` Kari Argillander
2021-09-28 17:18 ` [PATCH v2 3/3] fs/ntfs3: Refactoring of ntfs_init_from_boot Konstantin Komarov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b37cc1a-2951-77fa-9932-6052555ceca9@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=kari.argillander@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox