summaryrefslogtreecommitdiffstats
path: root/fs/nfs/getroot.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-07-30 14:58:27 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:38 -0400
commit738a35195941ecf604d3070e2a053e1df3de350b (patch)
treedd85dd6e48fad4a041d26ef6c36c4dd08537161f /fs/nfs/getroot.c
parent27ba851244f627a302d0fc6469d1ad413fc34fcb (diff)
downloadlinux-738a35195941ecf604d3070e2a053e1df3de350b.tar.bz2
NFS: Secure the roots of the NFS subtrees in a shared superblock
Invoke security_d_instantiate() on root dentries after allocating them with dentry_alloc_anon(). Normally dentry_alloc_root() would do that, but we don't call that as we don't want to assign a name to the root dentry at this point (we may discover the real name later). Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/getroot.c')
-rw-r--r--fs/nfs/getroot.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 977e59088eeb..76b08ae9ed82 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -33,6 +33,7 @@
#include <linux/vfs.h>
#include <linux/namei.h>
#include <linux/namespace.h>
+#include <linux/security.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -109,6 +110,8 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
return ERR_PTR(-ENOMEM);
}
+ security_d_instantiate(mntroot, inode);
+
if (!mntroot->d_op)
mntroot->d_op = server->nfs_client->rpc_ops->dentry_ops;
@@ -296,6 +299,8 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
return ERR_PTR(-ENOMEM);
}
+ security_d_instantiate(mntroot, inode);
+
if (!mntroot->d_op)
mntroot->d_op = server->nfs_client->rpc_ops->dentry_ops;