public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	davej@redhat.com
Subject: Re: [PATCH] vfs namespace: Don't assume mount namespace has valid root
Date: Wed, 14 Mar 2012 20:10:48 +0000	[thread overview]
Message-ID: <20120314201048.GI23916@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1331758710-16400-1-git-send-email-levinsasha928@gmail.com>

On Wed, Mar 14, 2012 at 04:58:30PM -0400, Sasha Levin wrote:
> This patch fixes the assumption that a mnt namespace will always have a valid
> root object.

It's not an assumption, it's an invariant that should hold unless you have
run into a bug somewhere.

Instances of struct mnt_namespace should *all* come from alloc_mnt_ns().
There are only two callers - dup_mnt_namespace() and create_mnt_ns().
The latter will assign non-NULL vfsmount to ->root or die NULL pointer
dereference in
                mnt->mnt_ns = new_ns;
The former will either assign non-NULL to ->root or kfree() mnt_namespace
before anyone can see it.

And nothing should modify ->root after that assignment for as long as
the instance of struct mnt_namespace is allocated.

Mind explaining how have you managed to get mnt_namespace with NULL ->root
passed to dup_mnt_ns()?

  reply	other threads:[~2012-03-14 20:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 20:58 [PATCH] vfs namespace: Don't assume mount namespace has valid root Sasha Levin
2012-03-14 20:10 ` Al Viro [this message]
2012-03-14 20:58   ` Al Viro
2012-03-14 21:03     ` Sasha Levin
2012-03-14 21:37       ` Al Viro
2012-03-14 22:00         ` Sasha Levin
2012-03-14 22:19           ` Al Viro
2012-03-15  1:05             ` Andi Kleen

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=20120314201048.GI23916@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=davej@redhat.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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