From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+73414091bd382684ee2b@syzkaller.appspotmail.com
Cc: bfoster@redhat.com, kent.overstreet@linux.dev,
linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: [PATCH] bcachefs: if input options invalid return -BCH_ERR_option_name
Date: Mon, 13 May 2024 20:07:17 +0800 [thread overview]
Message-ID: <tencent_8BBBDE33A39E011B1B4BFB1B332504BA4808@qq.com> (raw)
In-Reply-To: <0000000000001e59c20618455922@google.com>
When the input parameter options format is invalid, it will cause the opts object
to not be set correctly.
When a similar situation occurs, it should return -BCH_ERR_option_name and terminate
the mounting action.
Fixes: 03ef80b469d5 ("bcachefs: Ignore unknown mount options")
Reported-and-tested-by: syzbot+73414091bd382684ee2b@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/bcachefs/opts.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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;
--
2.43.0
prev parent reply other threads:[~2024-05-13 12:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-12 17:46 [syzbot] [bcachefs?] kernel BUG in cpu_replicas_add_entry syzbot
2024-05-13 12:07 ` Edward Adam Davis [this message]
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_8BBBDE33A39E011B1B4BFB1B332504BA4808@qq.com \
--to=eadavis@qq.com \
--cc=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+73414091bd382684ee2b@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).