Skip to content

Commit 489ecc4

Browse files
Hongbo LiKent Overstreet
authored andcommitted
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 ea0eeb8 ("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: ea0eeb8 ("bcachefs: reject unknown mount options") Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 07cf8ba commit 489ecc4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/bcachefs/opts.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts,
596596
copied_opts_start = copied_opts;
597597

598598
while ((opt = strsep(&copied_opts, ",")) != NULL) {
599+
if (!*opt)
600+
continue;
601+
599602
name = strsep(&opt, "=");
600603
val = opt;
601604

0 commit comments

Comments
 (0)