]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: fix error code in ext4_commit_super
authorFengnan Chang <changfengnan@vivo.com>
Fri, 2 Apr 2021 10:16:31 +0000 (18:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:38:19 +0000 (10:38 +0200)
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 <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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/super.c

index d4ecae25d8073de629da37fbabeff66011754c0e..1de02b90a1ef836efc6310ebf83d2c5852aaefb1 100644 (file)
@@ -4494,8 +4494,10 @@ static int ext4_commit_super(struct super_block *sb, int sync)
        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;
 
        /*
         * The superblock bh should be mapped, but it might not be if the