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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 20 Jul 2019 07:29:49 +0800
From:   Yin Fengwei <nh26223.lmm@...il.com>
To:     dhowells@...hat.com, gregkh@...uxfoundation.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        syzkaller-bugs@...glegroups.com, miklos@...redi.hu,
        viro@...iv.linux.org.uk, tglx@...utronix.de,
        kstewart@...uxfoundation.org
Subject: [PATCH v2] fs: fs_parser: avoid NULL param->string to kstrtouint

syzbot reported general protection fault in kstrtouint:
https://lkml.org/lkml/2019/7/18/328

>From the log, if the mount option is something like:
   fd,XXXXXXXXXXXXXXXXXXXX

The default parameter (which has NULL param->string) will be
passed to vfs_parse_fs_param. Finally, this NULL param->string
is passed to kstrtouint and trigger NULL pointer access.

Reported-by: syzbot+398343b7c1b1b989228d@...kaller.appspotmail.com
Fixes: 71cbb7570a9a ("vfs: Move the subtype parameter into fuse")

Signed-off-by: Yin Fengwei <nh26223.lmm@...il.com>
---
ChangeLog:
 v1 -> v2:
   - Fix typo in v1
   - Remove braces {} from single statement blocks

 fs/fs_parser.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index 83b66c9e9a24..7498a44f18c0 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -206,6 +206,9 @@ int fs_parse(struct fs_context *fc,
 	case fs_param_is_fd: {
 		switch (param->type) {
 		case fs_value_is_string:
+			if (!result->has_value)
+				goto bad_value;
+
 			ret = kstrtouint(param->string, 0, &result->uint_32);
 			break;
 		case fs_value_is_file:
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ