Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jack@suse.cz>

Jan Kara 5474ca7d 34e92542

+2
+2
fs/reiserfs/super.c
··· 629 629 reiserfs_write_unlock(s); 630 630 mutex_destroy(&REISERFS_SB(s)->lock); 631 631 destroy_workqueue(REISERFS_SB(s)->commit_wq); 632 + kfree(REISERFS_SB(s)->s_jdev); 632 633 kfree(s->s_fs_info); 633 634 s->s_fs_info = NULL; 634 635 } ··· 2241 2240 kfree(qf_names[j]); 2242 2241 } 2243 2242 #endif 2243 + kfree(sbi->s_jdev); 2244 2244 kfree(sbi); 2245 2245 2246 2246 s->s_fs_info = NULL;