From: Chen Zhongjin <chenzhongjin@huawei.com>
To: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Cc: <chenzhongjin@huawei.com>, <kari.argillander@gmail.com>,
<almaz.alexandrovich@paragon-software.com>
Subject: [PATCH] fs/ntfs3: Fix leaked mount_options if fill_super failed
Date: Tue, 22 Nov 2022 17:25:18 +0800 [thread overview]
Message-ID: <20221122092518.231347-1-chenzhongjin@huawei.com> (raw)
'9b75450d6c58 ("fs/ntfs3: Fix memory leak if fill_super failed")'
Previous patch fixed leaked sbi when fill_super failed but forgot to put
mount_options and left it leaked as kmemleak reported:
unreferenced object 0xffff888107c353c0 (size 32):
backtrace:
[<00000000cf2c8c32>] kmalloc_trace+0x27/0x110
[<000000000184a864>] ntfs_init_fs_context+0x4c/0x540 [ntfs3]
[<000000008ded85aa>] alloc_fs_context+0x50e/0x940
[<00000000c225e601>] path_mount+0x747/0x1930
[<000000007bf15a5f>] do_mount+0xf3/0x110
...
unreferenced object 0xffff888101fdc2d0 (size 8):
backtrace:
[<00000000d0cba437>] __kmalloc_node_track_caller+0x4c/0x1c0
[<00000000923513f8>] kmemdup_nul+0x37/0xb0
[<000000007a9b98ed>] vfs_parse_fs_string+0xc5/0x150
[<00000000afbd0594>] generic_parse_monolithic+0x140/0x1c0
[<00000000e97e814e>] path_mount+0xf09/0x1930
[<000000007bf15a5f>] do_mount+0xf3/0x110
...
Fixes: 610f8f5a7baf ("fs/ntfs3: Use new api for mounting")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
fs/ntfs3/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 47012c9bf505..c0e45f170701 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1281,6 +1281,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
* Free resources here.
* ntfs_fs_free will be called with fc->s_fs_info = NULL
*/
+ put_mount_options(sbi->options);
put_ntfs(sbi);
sb->s_fs_info = NULL;
--
2.17.1
next reply other threads:[~2022-11-22 9:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 9:25 Chen Zhongjin [this message]
2022-12-26 15:41 ` 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=20221122092518.231347-1-chenzhongjin@huawei.com \
--to=chenzhongjin@huawei.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=kari.argillander@gmail.com \
--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
all inboxes | Powered by JetHome®