mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+c0360e8367d6d8d04a66@syzkaller.appspotmail.com
Cc: brauner@kernel.org, jack@suse.cz,
	jfs-discussion@lists.sourceforge.net, kent.overstreet@linux.dev,
	linux-bcachefs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, shaggy@kernel.org,
	syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk
Subject: [PATCH] bcachefs: return the error code instead of the return value of IS_ERR_OR_NULL
Date: Wed, 25 Sep 2024 21:53:00 +0800	[thread overview]
Message-ID: <tencent_4A8FBB4133EA9E461B0C4B2C1B2425FFBA08@qq.com> (raw)
In-Reply-To: <66f33aad.050a0220.457fc.0030.GAE@google.com>

Syzbot report a kernel BUG in vfs_get_tree.
The root cause is that read_btree_nodes() returned 1 and returned -EINTR
due to kthread_run() execution failure.

The -EINTR needs to be returnned to bch2_fs_recovery(), not return to
"ret = IS_ERR_OR_NULL(t)".

Reported-and-tested-by: syzbot+c0360e8367d6d8d04a66@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c0360e8367d6d8d04a66
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/bcachefs/btree_node_scan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/bcachefs/btree_node_scan.c b/fs/bcachefs/btree_node_scan.c
index b28c649c6838..df7090ca1e81 100644
--- a/fs/bcachefs/btree_node_scan.c
+++ b/fs/bcachefs/btree_node_scan.c
@@ -281,6 +281,10 @@ static int read_btree_nodes(struct find_btree_nodes *f)
 			closure_put(&cl);
 			f->ret = ret;
 			bch_err(c, "error starting kthread: %i", ret);
+			if (IS_ERR(t)) {
+				closure_sync(&cl);
+				return PTR_ERR(t);
+			}
 			break;
 		}
 	}
-- 
2.43.0


  parent reply	other threads:[~2024-09-25 13:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 21:35 [syzbot] [bcachefs?] [jfs?] kernel BUG in vfs_get_tree syzbot
2024-09-24 22:18 ` [syzbot] [bcachefs?] " syzbot
2024-09-25  0:23   ` Edward Adam Davis
2024-09-25  0:41     ` syzbot
2024-09-25  1:26   ` Edward Adam Davis
2024-09-25  1:42     ` syzbot
2024-09-25 12:09   ` Edward Adam Davis
2024-09-25 12:26     ` syzbot
2024-09-25 12:42   ` Edward Adam Davis
2024-09-25 12:53     ` syzbot
2024-09-25 13:01   ` Edward Adam Davis
2024-09-25 13:26     ` syzbot
2024-09-25 13:53   ` Edward Adam Davis [this message]
2024-09-25 15:20     ` [PATCH] bcachefs: return the error code instead of the return value of IS_ERR_OR_NULL Kent Overstreet
2024-09-25  7:24 ` [syzbot] [bcachefs?] kernel BUG in vfs_get_tree syzbot

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=tencent_4A8FBB4133EA9E461B0C4B2C1B2425FFBA08@qq.com \
    --to=eadavis@qq.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaggy@kernel.org \
    --cc=syzbot+c0360e8367d6d8d04a66@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®