From: Hongbo Li Date: Thu, 10 Oct 2024 04:01:48 +0000 (+0800) Subject: bcachefs: skip mount option handle for empty string. X-Git-Tag: dma-mapping-6.13-2024-11-19~40^2~11 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=489ecc4cfddada303bd9c2b287a3c8744c324ed3;p=users%2Fhch%2Fdma-mapping.git bcachefs: skip mount option handle for empty string. The options parse in get_tree will split the options buffer, it will get the empty string for last one by strsep(). After commit ea0eeb89b1d5 ("bcachefs: reject unknown mount options") is merged, unknown mount options is not allowed (here is empty string), and this causes this errors. This can be reproduced just by the following steps: bcachefs format /dev/loop mount -t bcachefs -o metadata_target=loop1 /dev/loop1 /mnt/bcachefs/ Fixes: ea0eeb89b1d5 ("bcachefs: reject unknown mount options") Signed-off-by: Hongbo Li Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index 84097235eea9..68d240126522 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -596,6 +596,9 @@ int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts, copied_opts_start = copied_opts; while ((opt = strsep(&copied_opts, ",")) != NULL) { + if (!*opt) + continue; + name = strsep(&opt, "="); val = opt;