linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: YinFengwei <nh26223.lmm@gmail.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Yin Fengwei <nh26223.lmm@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kate Stewart <kstewart@linuxfoundation.org>
Subject: Re: [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint
Date: Sat, 20 Jul 2019 07:28:19 +0800	[thread overview]
Message-ID: <20190719232819.GA27852@fyin-linux> (raw)
In-Reply-To: <CACT4Y+aVS5nn0Pv31tAOujcAPvCAOuK_iPZ1CCNbgAOL=JDvvg@mail.gmail.com>

On Fri, Jul 19, 2019 at 03:37:37PM +0200, Dmitry Vyukov wrote:
> On Fri, Jul 19, 2019 at 2:44 PM Yin Fengwei <nh26223.lmm@gmail.com> wrote:
> >
> > 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@syzkaller.appspotmail.com
> > Fixes: 71cbb7570a9a ("vfs: Move the subtype parameter into fuse")
> >
> > Signed-off-by: Yin Fengwei <nh26223.lmm@gmail.com>
> > ---
> >  fs/fs_parser.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/fs/fs_parser.c b/fs/fs_parser.c
> > index d13fe7d797c2..578e6880ac67 100644
> > --- a/fs/fs_parser.c
> > +++ b/fs/fs_parser.c
> > @@ -210,6 +210,10 @@ int fs_parse(struct fs_context *fc,
> >         case fs_param_is_fd: {
> >                 switch (param->type) {
> >                 case fs_value_is_string:
> > +                       if (result->has_value) {
> 
> !result->has_value ?
Yes. Should have ! in condition for NULL param->string. Will fix in v2.

Regards
Yin, Fengwei

> 
> > +                               goto bad_value;
> > +                       }
> > +
> >                         ret = kstrtouint(param->string, 0, &result->uint_32);
> >                         break;
> >                 case fs_value_is_file:
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/20190719124329.23207-1-nh26223.lmm%40gmail.com.

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 12:43 [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint Yin Fengwei
2019-07-19 13:37 ` Dmitry Vyukov
2019-07-19 23:28   ` YinFengwei [this message]
2019-07-19 17:38 ` Greg KH
2019-07-19 23:29   ` YinFengwei

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=20190719232819.GA27852@fyin-linux \
    --to=nh26223.lmm@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dvyukov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).