diff options
author | Fengnan Chang <changfengnan@vivo.com> | 2021-04-02 18:16:31 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-11 14:04:16 +0200 |
commit | 92eb134265fae7cafeb9f7bedc86606a09904bad (patch) | |
tree | f3383430845921adc7d0020c19c33f7e482d40e8 | |
parent | c599462ab9c3e8af4a982ec899b3ac47709a2570 (diff) | |
download | linux-stable-92eb134265fae7cafeb9f7bedc86606a09904bad.tar.gz linux-stable-92eb134265fae7cafeb9f7bedc86606a09904bad.tar.bz2 linux-stable-92eb134265fae7cafeb9f7bedc86606a09904bad.zip |
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 <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>
-rw-r--r-- | fs/ext4/super.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ae37a3c8fa69..0b364f5e6fdf 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5057,8 +5057,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; /* * If the file system is mounted read-only, don't update the |