]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
reiserfs: Fix memory leak of journal device string
authorJan Kara <jack@suse.cz>
Thu, 12 Dec 2019 10:30:03 +0000 (11:30 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 6 Mar 2020 07:13:20 +0000 (02:13 -0500)
BugLink: https://bugs.launchpad.net/bugs/1864904
commit 5474ca7da6f34fa95e82edc747d5faa19cbdfb5c upstream.

When a filesystem is mounted with jdev mount option, we store the
journal device name in an allocated string in superblock. However we
fail to ever free that string. Fix it.

Reported-by: syzbot+1c6756baf4b16b94d2a6@syzkaller.appspotmail.com
Fixes: c3aa077648e1 ("reiserfs: Properly display mount options in /proc/mounts")
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/reiserfs/super.c

index a3507490be6e8d913c5eebaba4caad6df6fb9779..6280efeceb0a234bf21c82041cce2aef5c31841a 100644 (file)
@@ -629,6 +629,7 @@ static void reiserfs_put_super(struct super_block *s)
        reiserfs_write_unlock(s);
        mutex_destroy(&REISERFS_SB(s)->lock);
        destroy_workqueue(REISERFS_SB(s)->commit_wq);
+       kfree(REISERFS_SB(s)->s_jdev);
        kfree(s->s_fs_info);
        s->s_fs_info = NULL;
 }
@@ -2243,6 +2244,7 @@ error_unlocked:
                        kfree(qf_names[j]);
        }
 #endif
+       kfree(sbi->s_jdev);
        kfree(sbi);
 
        s->s_fs_info = NULL;