Skip to content

Commit cce2c56

Browse files
committed
logfs: initialize superblock entries earlier
In particular, s_freeing_list needs to be initialized early, since it is used on some of the error paths when mounts fail. The mapping inode, for example, would be initialized and then free'd on an error path before s_freeing_list was initialized, but the inode drop operation needs the s_freeing_list to be set up. Normally you'd never see this, because not only is logfs fairly rare, but a successful mount will never have any issues. Reported-by: werner <w.landgraf@ru.ru> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 609cfda commit cce2c56

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/logfs/super.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,6 @@ static int logfs_read_sb(struct super_block *sb, int read_only)
480480
!read_only)
481481
return -EIO;
482482

483-
mutex_init(&super->s_dirop_mutex);
484-
mutex_init(&super->s_object_alias_mutex);
485-
INIT_LIST_HEAD(&super->s_freeing_list);
486-
487483
ret = logfs_init_rw(sb);
488484
if (ret)
489485
return ret;
@@ -601,6 +597,10 @@ static struct dentry *logfs_mount(struct file_system_type *type, int flags,
601597
if (!super)
602598
return ERR_PTR(-ENOMEM);
603599

600+
mutex_init(&super->s_dirop_mutex);
601+
mutex_init(&super->s_object_alias_mutex);
602+
INIT_LIST_HEAD(&super->s_freeing_list);
603+
604604
if (!devname)
605605
err = logfs_get_sb_bdev(super, type, devname);
606606
else if (strncmp(devname, "mtd", 3))

0 commit comments

Comments
 (0)