aboutsummaryrefslogtreecommitdiff
path: root/fs/ntfs3/super.c
diff options
context:
space:
mode:
authorGravatar Shigeru Yoshida <syoshida@redhat.com> 2022-08-23 19:32:05 +0900
committerGravatar Konstantin Komarov <almaz.alexandrovich@paragon-software.com> 2022-09-30 17:39:51 +0300
commit51e76a232f8c037f1d9e9922edc25b003d5f3414 (patch)
treec0172a858654e4995cd934b392810bc67bcece6b /fs/ntfs3/super.c
parentfs/ntfs3: Use kmalloc_array for allocating multiple elements (diff)
downloadlinux-51e76a232f8c037f1d9e9922edc25b003d5f3414.tar.gz
linux-51e76a232f8c037f1d9e9922edc25b003d5f3414.tar.bz2
linux-51e76a232f8c037f1d9e9922edc25b003d5f3414.zip
fs/ntfs3: Fix memory leak on ntfs_fill_super() error path
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> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/super.c')
-rw-r--r--fs/ntfs3/super.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 27a36a0b08ec..569f38a2a51f 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1307,6 +1307,7 @@ out:
* 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;