fs/ntfs3/super.c | 1 + 1 file changed, 1 insertion(+)
'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
On 22.11.2022 13:25, Chen Zhongjin wrote:
> '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;
>
Thanks for work, this bug has already been fixed:
https://lore.kernel.org/ntfs3/20220823103205.1380235-1-syoshida@redhat.com/
© 2016 - 2026 Red Hat, Inc.