Re: [syzbot] [bcachefs?] BUG: unable to handle kernel paging request in bch2_opt_to_text

From: AP
Date: Thu Sep 19 2024 - 22:56:53 EST


On Thu, Sep 19, 2024 at 11:11:40PM +0800, Edward Adam Davis wrote:
> The format of the 'name=value' key value pair included in the options is
> incorrect, if only name is present.
>
> #syz test
>
> diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
> index e10fc1da71b1..5616dc8570fa 100644
> --- a/fs/bcachefs/opts.c
> +++ b/fs/bcachefs/opts.c
> @@ -472,6 +472,12 @@ int bch2_parse_one_mount_opt(struct bch_fs *c, struct bch_opts *opts,
> u64 v;
> int ret, id;
>
> + if (!val) {
> + pr_err("Bad mount option, value is NULL");

Given that this would be user visible, NULL is unlikely to mean much. I believe that it
would be better to state "value is missing but required." or similar. This clearly tells
the user how they erred regardless of their programming knowledge.

AP