archive mirror
 help / color / mirror / Atom feed
From: Yin Fengwei <>
Subject: [PATCH v2] fs: fs_parser: avoid NULL param->string to kstrtouint
Date: Sat, 20 Jul 2019 07:29:49 +0800	[thread overview]
Message-ID: <> (raw)

syzbot reported general protection fault in kstrtouint:

From the log, if the mount option is something like:

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.

Fixes: 71cbb7570a9a ("vfs: Move the subtype parameter into fuse")

Signed-off-by: Yin Fengwei <>
 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);
 		case fs_value_is_file:

             reply	other threads:[~2019-07-19 23:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 23:29 Yin Fengwei [this message]
2019-08-16  2:46 ` [PATCH v2] fs: fs_parser: avoid NULL param->string to kstrtouint Eric Biggers
2019-08-22  4:22   ` Eric Biggers
2019-08-22  5:33     ` Al Viro

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).