lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 13 May 2024 20:07:17 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+73414091bd382684ee2b@...kaller.appspotmail.com
Cc: bfoster@...hat.com,
	kent.overstreet@...ux.dev,
	linux-bcachefs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	syzkaller-bugs@...glegroups.com
Subject: [PATCH] bcachefs: if input options invalid return -BCH_ERR_option_name

When the input parameter options format is invalid, it will cause the opts object
to not be set correctly. 
When a similar situation occurs, it should return -BCH_ERR_option_name and terminate
the mounting action.

Fixes: 03ef80b469d5 ("bcachefs: Ignore unknown mount options")
Reported-and-tested-by: syzbot+73414091bd382684ee2b@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
 fs/bcachefs/opts.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index e1800c4119b5..2fc59b8aa32d 100644
--- a/fs/bcachefs/opts.c
+++ b/fs/bcachefs/opts.c
@@ -443,7 +443,7 @@ int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts,
 			  char *options)
 {
 	char *copied_opts, *copied_opts_start;
-	char *opt, *name, *val;
+	char *opt, *name, *val, opts_set = 0;
 	int ret, id;
 	struct printbuf err = PRINTBUF;
 	u64 v;
@@ -498,8 +498,11 @@ int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts,
 			goto bad_val;
 
 		bch2_opt_set_by_id(opts, id, v);
+		opts_set = 1;
 	}
 
+	if (!opts_set)
+		goto bad_opt;
 	ret = 0;
 	goto out;
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ