From: Jan Kara Date: Thu, 12 Dec 2019 10:30:03 +0000 (+0100) Subject: reiserfs: Fix memory leak of journal device string X-Git-Tag: v5.15~4597^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5474ca7da6f34fa95e82edc747d5faa19cbdfb5c;p=platform%2Fkernel%2Flinux-starfive.git reiserfs: Fix memory leak of journal device string 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 --- diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 3244037..d127af6 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -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; } @@ -2240,6 +2241,7 @@ error_unlocked: kfree(qf_names[j]); } #endif + kfree(sbi->s_jdev); kfree(sbi); s->s_fs_info = NULL;