[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHC9VhSbS6_Hp6_k0qpqQTvyG29ADx+b7JoXjDgXViO9bRXVMA@mail.gmail.com>
Date: Mon, 3 Jun 2019 16:59:38 -0400
From: Paul Moore <paul@...l-moore.com>
To: Gen Zhang <blackgod016574@...il.com>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>, omosnace@...hat.com,
selinux@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v3] selinux: lsm: fix a missing-check bug in selinux_sb_eat_lsm_opts()
On Fri, May 31, 2019 at 10:45 PM Gen Zhang <blackgod016574@...il.com> wrote:
> On Sat, Jun 01, 2019 at 03:25:27AM +0100, Al Viro wrote:
> > On Sat, Jun 01, 2019 at 10:15:26AM +0800, Gen Zhang wrote:
> > > In selinux_sb_eat_lsm_opts(), 'arg' is allocated by kmemdup_nul(). It
> > > returns NULL when fails. So 'arg' should be checked. And 'mnt_opts'
> > > should be freed when error.
> >
> > What's the latter one for? On failure we'll get to put_fs_context()
> > pretty soon, so
> > security_free_mnt_opts(&fc->security);
> > will be called just fine. Leaving it allocated on failure is fine...
> Paul Moore <paul@...l-moore.com> wrote:
> >It seems like we should also check for, and potentially free *mnt_opts
> >as the selinux_add_opt() error handling does just below this change,
> >yes? If that is the case we might want to move that error handling
> >code to the bottom of the function and jump there on error.
> I am not familiar with this part. So could you please show the function
> call sequence?
I'm not sure I understand your question above, but I did review your
latest patch and agree with Ondrej's comment regarding the ret/rc
variable. If you make that change I think we can merge this into
selinux/stable-5.2.
--
paul moore
www.paul-moore.com
Powered by blists - more mailing lists