]>
Commit | Line | Data |
---|---|---|
8f69975d BS |
1 | From: Tony Jones <tonyj@suse.de> |
2 | Subject: Add a struct vfsmount parameter to vfs_unlink() | |
3 | ||
4 | The vfsmount will be passed down to the LSM hook so that LSMs can compute | |
5 | pathnames. | |
6 | ||
7 | Signed-off-by: Tony Jones <tonyj@suse.de> | |
8 | Signed-off-by: Andreas Gruenbacher <agruen@suse.de> | |
9 | Signed-off-by: John Johansen <jjohansen@suse.de> | |
10 | ||
11 | --- | |
12 | fs/ecryptfs/inode.c | 3 ++- | |
13 | fs/namei.c | 4 ++-- | |
14 | fs/nfsd/nfs4recover.c | 2 +- | |
15 | fs/nfsd/vfs.c | 2 +- | |
16 | include/linux/fs.h | 2 +- | |
17 | ipc/mqueue.c | 2 +- | |
18 | 6 files changed, 8 insertions(+), 7 deletions(-) | |
19 | ||
20 | --- a/fs/ecryptfs/inode.c | |
21 | +++ b/fs/ecryptfs/inode.c | |
22 | @@ -445,11 +445,12 @@ static int ecryptfs_unlink(struct inode | |
23 | { | |
24 | int rc = 0; | |
25 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | |
26 | + struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | |
27 | struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir); | |
28 | struct dentry *lower_dir_dentry; | |
29 | ||
30 | lower_dir_dentry = lock_parent(lower_dentry); | |
31 | - rc = vfs_unlink(lower_dir_inode, lower_dentry); | |
32 | + rc = vfs_unlink(lower_dir_inode, lower_dentry, lower_mnt); | |
33 | if (rc) { | |
34 | printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); | |
35 | goto out_unlock; | |
36 | --- a/fs/namei.c | |
37 | +++ b/fs/namei.c | |
38 | @@ -2248,7 +2248,7 @@ SYSCALL_DEFINE1(rmdir, const char __user | |
39 | return do_rmdir(AT_FDCWD, pathname); | |
40 | } | |
41 | ||
42 | -int vfs_unlink(struct inode *dir, struct dentry *dentry) | |
43 | +int vfs_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt) | |
44 | { | |
45 | int error = may_delete(dir, dentry, 0); | |
46 | ||
47 | @@ -2313,7 +2313,7 @@ static long do_unlinkat(int dfd, const c | |
48 | error = mnt_want_write(nd.path.mnt); | |
49 | if (error) | |
50 | goto exit2; | |
51 | - error = vfs_unlink(nd.path.dentry->d_inode, dentry); | |
52 | + error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt); | |
53 | mnt_drop_write(nd.path.mnt); | |
54 | exit2: | |
55 | dput(dentry); | |
56 | --- a/fs/nfsd/nfs4recover.c | |
57 | +++ b/fs/nfsd/nfs4recover.c | |
58 | @@ -264,7 +264,7 @@ nfsd4_remove_clid_file(struct dentry *di | |
59 | return -EINVAL; | |
60 | } | |
61 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | |
62 | - status = vfs_unlink(dir->d_inode, dentry); | |
63 | + status = vfs_unlink(dir->d_inode, dentry, rec_dir.path.mnt); | |
64 | mutex_unlock(&dir->d_inode->i_mutex); | |
65 | return status; | |
66 | } | |
67 | --- a/fs/nfsd/vfs.c | |
68 | +++ b/fs/nfsd/vfs.c | |
69 | @@ -1832,7 +1832,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru | |
70 | host_err = -EPERM; | |
71 | } else | |
72 | #endif | |
73 | - host_err = vfs_unlink(dirp, rdentry); | |
74 | + host_err = vfs_unlink(dirp, rdentry, exp->ex_path.mnt); | |
75 | } else { /* It's RMDIR */ | |
76 | host_err = vfs_rmdir(dirp, rdentry, exp->ex_path.mnt); | |
77 | } | |
78 | --- a/include/linux/fs.h | |
79 | +++ b/include/linux/fs.h | |
80 | @@ -1183,7 +1183,7 @@ extern int vfs_mknod(struct inode *, str | |
81 | extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *); | |
82 | extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *); | |
83 | extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *); | |
84 | -extern int vfs_unlink(struct inode *, struct dentry *); | |
85 | +extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *); | |
86 | extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | |
87 | ||
88 | /* | |
89 | --- a/ipc/mqueue.c | |
90 | +++ b/ipc/mqueue.c | |
91 | @@ -746,7 +746,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __ | |
92 | err = mnt_want_write(mqueue_mnt); | |
93 | if (err) | |
94 | goto out_err; | |
95 | - err = vfs_unlink(dentry->d_parent->d_inode, dentry); | |
96 | + err = vfs_unlink(dentry->d_parent->d_inode, dentry, mqueue_mnt); | |
97 | mnt_drop_write(mqueue_mnt); | |
98 | out_err: | |
99 | dput(dentry); |