linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fengnan Chang <changfengnan@vivo.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org
Cc: Fengnan Chang <changfengnan@vivo.com>
Subject: [PATCH v2] ext4: fix error code in ext4_commit_super
Date: Fri,  2 Apr 2021 18:16:31 +0800	[thread overview]
Message-ID: <20210402101631.561-1-changfengnan@vivo.com> (raw)

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").

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
---
 fs/ext4/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 03373471131c..1130599c87dc 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5500,8 +5500,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
--
2.29.0


             reply	other threads:[~2021-04-02 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 10:16 Fengnan Chang [this message]
2021-04-03 18:34 ` [PATCH v2] ext4: fix error code in ext4_commit_super Andreas Dilger
2021-04-09 22:45   ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210402101631.561-1-changfengnan@vivo.com \
    --to=changfengnan@vivo.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).