netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gen Zhang <blackgod016574@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
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 10:44:59 +0800	[thread overview]
Message-ID: <20190601024459.GA8563@zhanggen-UX430UQ> (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...
Paul Moore <paul@paul-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?

Thanks
Gen

  parent reply	other threads:[~2019-06-01  2:45 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
2019-06-01  2:47     ` Gen Zhang
2019-06-01  2:44   ` Gen Zhang [this message]
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=20190601024459.GA8563@zhanggen-UX430UQ \
    --to=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 \
    --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).