[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120314201048.GI23916@ZenIV.linux.org.uk>
Date: Wed, 14 Mar 2012 20:10:48 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Sasha Levin <levinsasha928@...il.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
davej@...hat.com
Subject: Re: [PATCH] vfs namespace: Don't assume mount namespace has valid
root
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()?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists