mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+294f528e56138c357a48@syzkaller.appspotmail.com
Cc: kent.overstreet@linux.dev, linux-bcachefs@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: [PATCH] bcachefs: Fix null-ptr-deref in bch2_opt_to_text
Date: Fri, 20 Sep 2024 06:55:17 +0800	[thread overview]
Message-ID: <tencent_C2F02EF16C089514EB32EFFECC707A726F0A@qq.com> (raw)
In-Reply-To: <66eb6254.050a0220.92ef1.0009.GAE@google.com>

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@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=294f528e56138c357a48
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 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 NULL");
+		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


      parent reply	other threads:[~2024-09-19 23:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18 23:29 [syzbot] [bcachefs?] BUG: unable to handle kernel paging request " syzbot
2024-09-19 15:11 ` Edward Adam Davis
2024-09-19 18:43   ` syzbot
2024-09-20  2:37   ` AP
2024-09-20 12:07     ` [PATCH V2] bcachefs: Fix null-ptr-deref " Edward Adam Davis
2024-09-19 22:55 ` 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_C2F02EF16C089514EB32EFFECC707A726F0A@qq.com \
    --to=eadavis@qq.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+294f528e56138c357a48@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

all inboxes | Powered by JetHome®