From: Shigeru Yoshida <syoshida@redhat.com>
To: almaz.alexandrovich@paragon-software.com
Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org,
Shigeru Yoshida <syoshida@redhat.com>,
syzbot+9ccdd15480e9d9833822@syzkaller.appspotmail.com
Subject: [PATCH] fs/ntfs3: Fix memory leak in ntfs_fill_super()
Date: Sun, 17 Sep 2023 02:58:52 +0900 [thread overview]
Message-ID: <20230916175852.1607269-1-syoshida@redhat.com> (raw)
syzbot reported memory leak in ntfs_fill_super(). ntfs_fill_super() calls
wnd_init() and this allocates memory. So, we need to free those memory on the
error handling path in ntfs_fill_super().
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Reported-and-tested-by: syzbot+9ccdd15480e9d9833822@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9ccdd15480e9d9833822
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
fs/ntfs3/super.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index cfec5e0c7f66..a9610f5f4cc0 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1563,6 +1563,13 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
iput(inode);
out:
kfree(boot2);
+
+ if (sbi->mft.bitmap.inited)
+ wnd_close(&sbi->mft.bitmap);
+
+ if (sbi->used.bitmap.inited)
+ wnd_close(&sbi->used.bitmap);
+
return err;
}
--
2.41.0
next reply other threads:[~2023-09-16 18:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-16 17:58 Shigeru Yoshida [this message]
2025-12-11 13:51 [PATCH] fs/ntfs3: fix " Konstantin Komarov
2025-12-11 14:33 ` 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=20230916175852.1607269-1-syoshida@redhat.com \
--to=syoshida@redhat.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=syzbot+9ccdd15480e9d9833822@syzkaller.appspotmail.com \
/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
all inboxes | Powered by JetHome®