From: Fengnan Chang Date: Fri, 2 Apr 2021 10:16:31 +0000 (+0800) Subject: ext4: fix error code in ext4_commit_super X-Git-Tag: v5.11.20~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e3c7194e8dde59143c101b448cc6a084c1071c5;p=thirdparty%2Fkernel%2Fstable.git ext4: fix error code in ext4_commit_super commit f88f1466e2a2e5ca17dfada436d3efa1b03a3972 upstream. 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 Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20210402101631.561-1-changfengnan@vivo.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ca7b4af14e1e1..ce883bed1355a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5559,8 +5559,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);