netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Gen Zhang <blackgod016574@gmail.com>
Cc: paul@paul-moore.com, sds@tycho.nsa.gov, eparis@parisplace.org,
	omosnace@redhat.com, selinux@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v3] selinux: lsm: fix a missing-check bug in selinux_sb_eat_lsm_opts()
Date: Sat, 1 Jun 2019 03:34:49 +0100	[thread overview]
Message-ID: <20190601023449.GS17978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20190601022527.GR17978@ZenIV.linux.org.uk>

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...

Actually, right now in mainline it is not (btrfs_mount_root() has
an odd call of security_sb_eat_lsm_opts()); eventually we will be
down to just the callers in ->parse_monolithic() instances, at which
point the above will become correct.  At the moment it is not, so
consider the objection withdrawn (and I really need to get some sleep,
seeing how long did it take me to recall the context... ;-/)

  reply	other threads:[~2019-06-01  2:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-01  2:15 [PATCH v3] selinux: lsm: fix a missing-check bug in selinux_sb_eat_lsm_opts() Gen Zhang
2019-06-01  2:25 ` Al Viro
2019-06-01  2:34   ` Al Viro [this message]
2019-06-01  2:47     ` Gen Zhang
2019-06-01  2:44   ` Gen Zhang
2019-06-03 20:59     ` Paul Moore
2019-06-03  7:23 ` Ondrej Mosnacek
2019-06-03 21:15   ` Paul Moore
2019-06-03  7:27 ` Ondrej Mosnacek
2019-06-03 20:57   ` Paul Moore

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=20190601023449.GS17978@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=blackgod016574@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=eparis@parisplace.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    /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).