summaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorFengnan Chang <changfengnan@vivo.com>2021-04-02 12:16:31 +0200
committerTheodore Ts'o <tytso@mit.edu>2021-04-10 02:52:51 +0200
commitf88f1466e2a2e5ca17dfada436d3efa1b03a3972 (patch)
tree17f1f5d65748c7ed91b246f4f1eedabd12cd14ef /fs/ext4/super.c
parentext4: always panic when errors=panic is specified (diff)
downloadlinux-f88f1466e2a2e5ca17dfada436d3efa1b03a3972.tar.xz
linux-f88f1466e2a2e5ca17dfada436d3efa1b03a3972.zip
ext4: fix error code in ext4_commit_super
We should set the error code when ext4_commit_super check argument failed. Found in code review. Fixes: c4be0c1dc4cdc ("filesystem freeze: add error handling of write_super_lockfs/unlockfs"). Cc: stable@kernel.org Signed-off-by: Fengnan Chang <changfengnan@vivo.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Link: https://lore.kernel.org/r/20210402101631.561-1-changfengnan@vivo.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d92360d6bf26..1f5ef17f714a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5585,8 +5585,10 @@ static int ext4_commit_super(struct super_block *sb)
struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
int error = 0;
- if (!sbh || block_device_ejected(sb))
- return error;
+ if (!sbh)
+ return -EINVAL;
+ if (block_device_ejected(sb))
+ return -ENODEV;
ext4_update_super(sb);