From: David Howells Date: Sun, 30 Jul 2006 18:58:27 +0000 (-0400) Subject: NFS: Secure the roots of the NFS subtrees in a shared superblock X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=738a35195941ecf604d3070e2a053e1df3de350b;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Trond Myklebust --- 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 #include #include +#include #include #include @@ -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;