Commit 738a35195941ecf604d3070e2a053e1df3de350b
Committed by
Trond Myklebust
1 parent
27ba851244
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff
fs/nfs/getroot.c
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | #include <linux/vfs.h> |
34 | 34 | #include <linux/namei.h> |
35 | 35 | #include <linux/namespace.h> |
36 | +#include <linux/security.h> | |
36 | 37 | |
37 | 38 | #include <asm/system.h> |
38 | 39 | #include <asm/uaccess.h> |
... | ... | @@ -109,6 +110,8 @@ |
109 | 110 | return ERR_PTR(-ENOMEM); |
110 | 111 | } |
111 | 112 | |
113 | + security_d_instantiate(mntroot, inode); | |
114 | + | |
112 | 115 | if (!mntroot->d_op) |
113 | 116 | mntroot->d_op = server->nfs_client->rpc_ops->dentry_ops; |
114 | 117 | |
... | ... | @@ -295,6 +298,8 @@ |
295 | 298 | dprintk("nfs_get_root: get root dentry failed\n"); |
296 | 299 | return ERR_PTR(-ENOMEM); |
297 | 300 | } |
301 | + | |
302 | + security_d_instantiate(mntroot, inode); | |
298 | 303 | |
299 | 304 | if (!mntroot->d_op) |
300 | 305 | mntroot->d_op = server->nfs_client->rpc_ops->dentry_ops; |