[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190530073834.GB2382@zhanggen-UX430UQ>
Date: Thu, 30 May 2019 15:38:34 +0800
From: Gen Zhang <blackgod016574@...il.com>
To: William Roberts <bill.c.roberts@...il.com>
Cc: Paul Moore <paul@...l-moore.com>, tony.luck@...el.com,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>, selinux@...r.kernel.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH] hooks: fix a missing-check bug in
selinux_sb_eat_lsm_opts()
On Wed, May 29, 2019 at 09:39:50PM -0700, William Roberts wrote:
> On Wed, May 29, 2019 at 8:55 PM Gen Zhang <blackgod016574@...il.com> wrote:
> >
> > In selinux_sb_eat_lsm_opts(), 'arg' is allocated by kmemdup_nul(). It
> > returns NULL when fails. So 'arg' should be checked.
> >
> > Signed-off-by: Gen Zhang <blackgod016574@...il.com>
> > ---
> > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> > index 3ec702c..5a9e959 100644
> > --- a/security/selinux/hooks.c
> > +++ b/security/selinux/hooks.c
> > @@ -2635,6 +2635,8 @@ static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts)
> > *q++ = c;
> > }
> > arg = kmemdup_nul(arg, q - arg, GFP_KERNEL);
> > + if (!arg)
> > + return 0;
>
> The routine seems to return 0 on success, why would it return 0 on ENOMEM?
>
Thanks for your reply, William. I re-examined the source code and didn't
figure out what the return value should be in this situation. Could it
be a -ENOMEM? Do you have any idea?
Thanks
Gen
> > }
> > rc = selinux_add_opt(token, arg, mnt_opts);
> > if (unlikely(rc)) {
Powered by blists - more mailing lists