[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_E7E4563771B76EA6CBD3758379C96FA3A405@qq.com>
Date: Fri, 20 Sep 2024 20:07:02 +0800
From: Edward Adam Davis <eadavis@...com>
To: lkml@...l.grue.cc
Cc: eadavis@...com,
kent.overstreet@...ux.dev,
linux-bcachefs@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzbot+294f528e56138c357a48@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com
Subject: [PATCH V2] bcachefs: Fix null-ptr-deref in bch2_opt_to_text
The mounting option values passed in by syzbot are:
"metadata_checksum=crc64, errors=continue, obj_user={^, subj_user=obj_ur,
approve", which does not meet the "key1=value1,key2=value2,..." requirement
of the bcachefs.
Reported-and-tested-by: syzbot+294f528e56138c357a48@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=294f528e56138c357a48
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
V1 -> V2: adjust error messages
fs/bcachefs/opts.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index e10fc1da71b1..78307e092075 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 missing but required");
+ ret = -BCH_ERR_option_value;
+ goto out;
+ }
+
id = bch2_mount_opt_lookup(name);
/* Check for the form "noopt", negation of a boolean opt: */
--
2.43.0
Powered by blists - more mailing lists