* [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint
@ 2019-07-19 12:43 Yin Fengwei
2019-07-19 13:37 ` Dmitry Vyukov
2019-07-19 17:38 ` Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Yin Fengwei @ 2019-07-19 12:43 UTC (permalink / raw)
To: dhowells, gregkh, linux-fsdevel, linux-kernel, syzkaller-bugs,
miklos, viro, tglx, kstewart
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) {
+ goto bad_value;
+ }
+
ret = kstrtouint(param->string, 0, &result->uint_32);
break;
case fs_value_is_file:
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint
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
2019-07-19 17:38 ` Greg KH
1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Vyukov @ 2019-07-19 13:37 UTC (permalink / raw)
To: Yin Fengwei
Cc: David Howells, Greg Kroah-Hartman, linux-fsdevel, LKML,
syzkaller-bugs, Miklos Szeredi, Al Viro, Thomas Gleixner,
Kate Stewart
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 ?
> + 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint
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 17:38 ` Greg KH
2019-07-19 23:29 ` YinFengwei
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-07-19 17:38 UTC (permalink / raw)
To: Yin Fengwei
Cc: dhowells, linux-fsdevel, linux-kernel, syzkaller-bugs, miklos,
viro, tglx, kstewart
On Fri, Jul 19, 2019 at 08:43:29PM +0800, Yin Fengwei 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) {
> + goto bad_value;
> + }
Always run checkpatch.pl so grumpy maintainers do not tell you to go run
checkpatch.pl :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint
2019-07-19 13:37 ` Dmitry Vyukov
@ 2019-07-19 23:28 ` YinFengwei
0 siblings, 0 replies; 5+ messages in thread
From: YinFengwei @ 2019-07-19 23:28 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: Yin Fengwei, David Howells, Greg Kroah-Hartman, linux-fsdevel,
LKML, syzkaller-bugs, Miklos Szeredi, Al Viro, Thomas Gleixner,
Kate Stewart
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs: fs_parser: avoid NULL param->string to kstrtouint
2019-07-19 17:38 ` Greg KH
@ 2019-07-19 23:29 ` YinFengwei
0 siblings, 0 replies; 5+ messages in thread
From: YinFengwei @ 2019-07-19 23:29 UTC (permalink / raw)
To: Greg KH
Cc: Yin Fengwei, dhowells, linux-fsdevel, linux-kernel,
syzkaller-bugs, miklos, viro, tglx, kstewart
On Fri, Jul 19, 2019 at 07:38:11PM +0200, Greg KH wrote:
> On Fri, Jul 19, 2019 at 08:43:29PM +0800, Yin Fengwei 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) {
> > + goto bad_value;
> > + }
>
> Always run checkpatch.pl so grumpy maintainers do not tell you to go run
> checkpatch.pl :)
Thanks a lot for kindly reminder. Will be careful for future patch. :)
Regards
Yin, Fengwei
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-07-19 23:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-07-19 17:38 ` Greg KH
2019-07-19 23:29 ` YinFengwei
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.