public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Andreas Dilger <adilger@dilger.ca>,
	Jason Yan <yanaijie@huawei.com>, "Theodore Ts'o" <tytso@mit.edu>,
	syzbot+bbf0f9a213c94f283a5c@syzkaller.appspotmail.com
Subject: [PATCH 1/3] ext4: fix lost error code reporting in __ext4_fill_super()
Date: Thu, 27 Apr 2023 23:16:00 -0400	[thread overview]
Message-ID: <20230428031602.242297-2-tytso@mit.edu> (raw)
In-Reply-To: <20230428031602.242297-1-tytso@mit.edu>

When code was factored out of __ext4_fill_super() into
ext4_percpu_param_init() the error return was discard.  This meant
that it was possible for __ext4_fill_super() to return zero,
indicating success, without the struct super getting completely filled
in, leading to a potential NULL pointer dereference.

Reported-by: syzbot+bbf0f9a213c94f283a5c@syzkaller.appspotmail.com
Fixes: 1f79467c8a6b ("ext4: factor out ext4_percpu_param_init() ...")
Cc: Jason Yan <yanaijie@huawei.com>
Link: https://syzkaller.appspot.com/bug?id=6dac47d5e58af770c0055f680369586ec32e144c
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 403cc0e6cd65..b11907e1fab2 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5503,7 +5503,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 		sbi->s_journal->j_commit_callback =
 			ext4_journal_commit_callback;
 
-	if (ext4_percpu_param_init(sbi))
+	err = ext4_percpu_param_init(sbi);
+	if (err)
 		goto failed_mount6;
 
 	if (ext4_has_feature_flex_bg(sb))
-- 
2.31.0


  reply	other threads:[~2023-04-28  3:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28  3:15 [PATCH 0/3] ext4: clean up error handling Theodore Ts'o
2023-04-28  3:16 ` Theodore Ts'o [this message]
2023-04-28  3:35   ` [PATCH 1/3] ext4: fix lost error code reporting in __ext4_fill_super() Jason Yan
2023-04-28  3:16 ` [PATCH 2/3] ext4: reflect error codes from ext4_multi_mount_protect() to its callers Theodore Ts'o
2023-04-28  3:39   ` Jason Yan
2023-04-28  3:16 ` [PATCH 3/3] ext4: clean up error handling in __ext4_fill_super() Theodore Ts'o
2023-04-28  6:08   ` Jason Yan

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=20230428031602.242297-2-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=syzbot+bbf0f9a213c94f283a5c@syzkaller.appspotmail.com \
    --cc=yanaijie@huawei.com \
    /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