linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seth Forshee <seth.forshee@canonical.com>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	devel@openvz.org, Serge Hallyn <serge.hallyn@canonical.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Jeff Layton <jlayton@poochiereds.net>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Andy Lutomirski <luto@amacapital.net>,
	linux-security-module@vger.kernel.org,
	linux-mtd@lists.infradead.org, selinux@tycho.nsa.gov,
	linux-fsdevel@vger.kernel.org,
	Konstantin Khorenko <khorenko@virtuozzo.com>,
	Pavel Emelyanov <xemul@virtuozzo.com>
Subject: Re: [PATCH] fs: fix a posible leak of allocated superblock
Date: Tue, 15 Mar 2016 08:32:41 -0500	[thread overview]
Message-ID: <20160315133241.GA27754@ubuntu-xps13> (raw)
In-Reply-To: <1458043730-14296-1-git-send-email-ptikhomirov@virtuozzo.com>

On Tue, Mar 15, 2016 at 03:08:50PM +0300, Pavel Tikhomirov wrote:
> We probably need to fix superblock leak in patch (v4 "fs: Add user
> namesapace member to struct super_block"):
> 
> Imagine posible code path in sget_userns: we iterate through
> type->fs_supers and do not find suitable sb, we drop sb_lock to
> allocate s and go to retry. After we dropped sb_lock some other
> task from different userns takes sb_lock, it is already in retry
> stage and has s allocated, so it puts its s in type->fs_supers
> list. So in retry we will find these sb in list and check it has
> a different userns, and finally we will return without freeing s.
> 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

Good catch.

Acked-by: Seth Forshee <seth.forshee@canonical.com>

  reply	other threads:[~2016-03-15 13:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 20:16 [PATCH v4 0/7] Initial support for user namespace owned mounts Seth Forshee
2015-09-23 20:16 ` [PATCH v4 1/7] fs: Add user namesapace member to struct super_block Seth Forshee
2015-09-24 21:14   ` Eric W. Biederman
2015-09-25 12:54     ` Seth Forshee
2015-09-25 17:27       ` Eric W. Biederman
2016-03-15 12:08   ` [PATCH] fs: fix a posible leak of allocated superblock Pavel Tikhomirov
2016-03-15 13:32     ` Seth Forshee [this message]
2015-09-23 20:16 ` [PATCH v4 2/7] userns: Simpilify MNT_NODEV handling Seth Forshee
2015-09-23 20:16 ` [PATCH v4 3/7] fs: Verify access of user towards block device file when mounting Seth Forshee
2015-09-24 21:53   ` Eric W. Biederman
2015-09-25 12:48     ` Seth Forshee
2015-09-25 17:16       ` Eric W. Biederman
2015-09-25 17:39         ` Seth Forshee
2015-09-25 17:49           ` Eric W. Biederman
2015-09-23 20:16 ` [PATCH v4 4/7] fs: Limit file caps to the user namespace of the super block Seth Forshee
2015-09-24 21:59   ` Eric W. Biederman
2015-09-25 12:49     ` Seth Forshee
2015-09-25 17:57       ` Eric W. Biederman
2015-09-23 20:16 ` [PATCH v4 5/7] fs: Treat foreign mounts as nosuid Seth Forshee
2015-09-23 20:16 ` [PATCH v4 6/7] Smack: Add support for unprivileged mounts from user namespaces Seth Forshee
2015-09-24 22:16   ` Eric W. Biederman
2015-09-24 22:34   ` Casey Schaufler
2015-09-27 19:30   ` Eric W. Biederman
2015-09-28 19:45     ` Seth Forshee
2015-09-23 20:16 ` [PATCH v4 7/7] selinux: " Seth Forshee

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=20160315133241.GA27754@ubuntu-xps13 \
    --to=seth.forshee@canonical.com \
    --cc=bfields@fieldses.org \
    --cc=devel@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=jlayton@poochiereds.net \
    --cc=khorenko@virtuozzo.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=selinux@tycho.nsa.gov \
    --cc=serge.hallyn@canonical.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xemul@virtuozzo.com \
    /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).