| From 63d6af164d6aaf120f37e4a4329dba3b3dcc2cd4 Mon Sep 17 00:00:00 2001 |
| From: Jan Kara <jack@suse.cz> |
| Date: Thu, 12 Dec 2019 11:30:03 +0100 |
| Subject: [PATCH] reiserfs: Fix memory leak of journal device string |
| |
| 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: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c |
| index c00a34b801b4..4f20da6ec324 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; |
| } |
| @@ -2237,6 +2238,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) |
| kfree(qf_names[j]); |
| } |
| #endif |
| + kfree(sbi->s_jdev); |
| kfree(sbi); |
| |
| s->s_fs_info = NULL; |
| -- |
| 2.7.4 |
| |