Re: [syzbot] [bcachefs?] kernel BUG in cpu_replicas_add_entry
From: Edward Adam Davis
Date: Mon May 13 2024 - 07:11:39 EST
please test kb in cpu_replicas_add_entry
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git cf87f46fd34d
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index e1800c4119b5..2fc59b8aa32d 100644
--- a/fs/bcachefs/opts.c
+++ b/fs/bcachefs/opts.c
@@ -443,7 +443,7 @@ int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts,
char *options)
{
char *copied_opts, *copied_opts_start;
- char *opt, *name, *val;
+ char *opt, *name, *val, opts_set = 0;
int ret, id;
struct printbuf err = PRINTBUF;
u64 v;
@@ -498,8 +498,11 @@ int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts,
goto bad_val;
bch2_opt_set_by_id(opts, id, v);
+ opts_set = 1;
}
+ if (!opts_set)
+ goto bad_opt;
ret = 0;
goto out;