Skip to contentSkip to conversation

reiserfs: Two small fixes

PATCH New Jan Kara 1 participant 3 messages Dec 12, 2019

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

cover reiserfs: Two small fixes

Hello,

these two patches fix two small issues in reiserfs, one of them spotted by syzbot (which made me look into the code and find the second). If nobody objects, I'll merge these through my tree.

Honza

author reviewer
#1 lore raw

PATCH 1/2 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 [email protected]
Fixes c3aa077648e1 ("reiserfs: Properly display mount options in /proc/mounts")
---
 fs/reiserfs/super.c | 2 ++
 1 file changed, 2 insertions(+)
fs/reiserfs/super.c +2 -0
index 3244037b1286..d127af64283e 100644
@@ -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 @@ 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;
Signature · 1 line
2.16.4
author reviewer
#2 lore raw

PATCH 2/2 reiserfs: Fix spurious unlock in reiserfs_fill_super() error handling

In reply to Jan Kara

When we fail to allocate string for journal device name we jump to 'error' label which tries to unlock reiserfs write lock which is not held. Jump to 'error_unlocked' instead.

Fixes f32485be8397 ("reiserfs: delay reiserfs lock until journal initialization")
---
 fs/reiserfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/reiserfs/super.c +1 -1
index d127af64283e..a6bce5b1fb1d 100644
@@ -1948,7 +1948,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 		if (!sbi->s_jdev) {
 			SWARN(silent, s, "", "Cannot allocate memory for "
 				"journal device name");
-			goto error;
+			goto error_unlocked;
 		}
 	}
 #ifdef CONFIG_QUOTA
Signature · 1 line
2.16.4