From 51a8236316212f969c38df3cd422a33717e34f36 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 29 Jun 2022 14:51:29 -0700 Subject: [PATCH] Fix missed partial fill_super teardown If we return an error from .fill_super without having set sb->s_root then the vfs won't call our put_super. Our fill_super is careful to call put_super so that it can tear down partial state, but we weren't doing this with a few very early errors in fill_super. This tripped leak detection when we weren't freeing the sbi when returning errors from bad option parsing. Signed-off-by: Zach Brown --- kmod/src/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmod/src/super.c b/kmod/src/super.c index 5cac5148..d38fcb65 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -496,7 +496,7 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent) ret = assign_random_id(sbi); if (ret < 0) - return ret; + goto out; spin_lock_init(&sbi->next_ino_lock); spin_lock_init(&sbi->data_wait_root.lock); @@ -505,7 +505,7 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent) /* parse options early for use during setup */ ret = scoutfs_options_early_setup(sb, data); if (ret < 0) - return ret; + goto out; scoutfs_options_read(sb, &opts); ret = sb_set_blocksize(sb, SCOUTFS_BLOCK_SM_SIZE);