All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path
@ 2022-08-23 10:32 Shigeru Yoshida
  2022-09-07 16:01 ` Shigeru Yoshida
  2022-09-30 15:51 ` Konstantin Komarov
  0 siblings, 2 replies; 3+ messages in thread
From: Shigeru Yoshida @ 2022-08-23 10:32 UTC (permalink / raw)
  To: almaz.alexandrovich
  Cc: ntfs3, linux-kernel, Shigeru Yoshida, syzbot+9d67170b20e8f94351c8

syzbot reported kmemleak as below:

BUG: memory leak
unreferenced object 0xffff8880122f1540 (size 32):
  comm "a.out", pid 6664, jiffies 4294939771 (age 25.500s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 ed ff ed ff 00 00 00 00  ................
  backtrace:
    [<ffffffff81b16052>] ntfs_init_fs_context+0x22/0x1c0
    [<ffffffff8164aaa7>] alloc_fs_context+0x217/0x430
    [<ffffffff81626dd4>] path_mount+0x704/0x1080
    [<ffffffff81627e7c>] __x64_sys_mount+0x18c/0x1d0
    [<ffffffff84593e14>] do_syscall_64+0x34/0xb0
    [<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

This patch fixes this issue by freeing mount options on error path of
ntfs_fill_super().

Reported-by: syzbot+9d67170b20e8f94351c8@syzkaller.appspotmail.com
Signed-off-by: Shigeru Yoshida <syoshida@redhat.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.37.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path
  2022-08-23 10:32 [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path Shigeru Yoshida
@ 2022-09-07 16:01 ` Shigeru Yoshida
  2022-09-30 15:51 ` Konstantin Komarov
  1 sibling, 0 replies; 3+ messages in thread
From: Shigeru Yoshida @ 2022-09-07 16:01 UTC (permalink / raw)
  To: almaz.alexandrovich
  Cc: ntfs3, linux-kernel, syoshida, syzbot+9d67170b20e8f94351c8

ping?

On Tue, 23 Aug 2022 19:32:05 +0900, Shigeru Yoshida wrote:
> syzbot reported kmemleak as below:
> 
> BUG: memory leak
> unreferenced object 0xffff8880122f1540 (size 32):
>   comm "a.out", pid 6664, jiffies 4294939771 (age 25.500s)
>   hex dump (first 32 bytes):
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>     00 00 00 00 00 00 00 00 ed ff ed ff 00 00 00 00  ................
>   backtrace:
>     [<ffffffff81b16052>] ntfs_init_fs_context+0x22/0x1c0
>     [<ffffffff8164aaa7>] alloc_fs_context+0x217/0x430
>     [<ffffffff81626dd4>] path_mount+0x704/0x1080
>     [<ffffffff81627e7c>] __x64_sys_mount+0x18c/0x1d0
>     [<ffffffff84593e14>] do_syscall_64+0x34/0xb0
>     [<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
> 
> This patch fixes this issue by freeing mount options on error path of
> ntfs_fill_super().
> 
> Reported-by: syzbot+9d67170b20e8f94351c8@syzkaller.appspotmail.com
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.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.37.2
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path
  2022-08-23 10:32 [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path Shigeru Yoshida
  2022-09-07 16:01 ` Shigeru Yoshida
@ 2022-09-30 15:51 ` Konstantin Komarov
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Komarov @ 2022-09-30 15:51 UTC (permalink / raw)
  To: Shigeru Yoshida; +Cc: ntfs3, linux-kernel, syzbot+9d67170b20e8f94351c8



On 8/23/22 13:32, Shigeru Yoshida wrote:
> syzbot reported kmemleak as below:
> 
> BUG: memory leak
> unreferenced object 0xffff8880122f1540 (size 32):
>    comm "a.out", pid 6664, jiffies 4294939771 (age 25.500s)
>    hex dump (first 32 bytes):
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>      00 00 00 00 00 00 00 00 ed ff ed ff 00 00 00 00  ................
>    backtrace:
>      [<ffffffff81b16052>] ntfs_init_fs_context+0x22/0x1c0
>      [<ffffffff8164aaa7>] alloc_fs_context+0x217/0x430
>      [<ffffffff81626dd4>] path_mount+0x704/0x1080
>      [<ffffffff81627e7c>] __x64_sys_mount+0x18c/0x1d0
>      [<ffffffff84593e14>] do_syscall_64+0x34/0xb0
>      [<ffffffff84600087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
> 
> This patch fixes this issue by freeing mount options on error path of
> ntfs_fill_super().
> 
> Reported-by: syzbot+9d67170b20e8f94351c8@syzkaller.appspotmail.com
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.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 patch, applied!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-30 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 10:32 [PATCH] fs/ntfs3: Fix memory leak on ntfs_fill_super() error path Shigeru Yoshida
2022-09-07 16:01 ` Shigeru Yoshida
2022-09-30 15:51 ` Konstantin Komarov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.