]>
Commit | Line | Data |
---|---|---|
4d1e5b62 AF |
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,12 +445,13 @@ 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 | dget(lower_dentry); | |
31 | lower_dir_dentry = lock_parent(lower_dentry); | |
32 | - rc = vfs_unlink(lower_dir_inode, lower_dentry); | |
33 | + rc = vfs_unlink(lower_dir_inode, lower_dentry, lower_mnt); | |
34 | if (rc) { | |
35 | printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); | |
36 | goto out_unlock; | |
37 | --- a/fs/namei.c | |
38 | +++ b/fs/namei.c | |
39 | @@ -2248,7 +2248,7 @@ SYSCALL_DEFINE1(rmdir, const char __user | |
40 | return do_rmdir(AT_FDCWD, pathname); | |
41 | } | |
42 | ||
43 | -int vfs_unlink(struct inode *dir, struct dentry *dentry) | |
44 | +int vfs_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt) | |
45 | { | |
46 | int error = may_delete(dir, dentry, 0); | |
47 | ||
48 | @@ -2313,7 +2313,7 @@ static long do_unlinkat(int dfd, const c | |
49 | error = mnt_want_write(nd.path.mnt); | |
50 | if (error) | |
51 | goto exit2; | |
52 | - error = vfs_unlink(nd.path.dentry->d_inode, dentry); | |
53 | + error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt); | |
54 | mnt_drop_write(nd.path.mnt); | |
55 | exit2: | |
56 | dput(dentry); | |
57 | --- a/fs/nfsd/nfs4recover.c | |
58 | +++ b/fs/nfsd/nfs4recover.c | |
59 | @@ -264,7 +264,7 @@ nfsd4_remove_clid_file(struct dentry *di | |
60 | return -EINVAL; | |
61 | } | |
62 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | |
63 | - status = vfs_unlink(dir->d_inode, dentry); | |
64 | + status = vfs_unlink(dir->d_inode, dentry, rec_dir.path.mnt); | |
65 | mutex_unlock(&dir->d_inode->i_mutex); | |
66 | return status; | |
67 | } | |
68 | --- a/fs/nfsd/vfs.c | |
69 | +++ b/fs/nfsd/vfs.c | |
70 | @@ -1833,7 +1833,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru | |
71 | host_err = -EPERM; | |
72 | } else | |
73 | #endif | |
74 | - host_err = vfs_unlink(dirp, rdentry); | |
75 | + host_err = vfs_unlink(dirp, rdentry, exp->ex_path.mnt); | |
76 | } else { /* It's RMDIR */ | |
77 | host_err = vfs_rmdir(dirp, rdentry, exp->ex_path.mnt); | |
78 | } | |
79 | --- a/include/linux/fs.h | |
80 | +++ b/include/linux/fs.h | |
81 | @@ -1183,7 +1183,7 @@ extern int vfs_mknod(struct inode *, str | |
82 | extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *); | |
83 | extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *); | |
84 | extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *); | |
85 | -extern int vfs_unlink(struct inode *, struct dentry *); | |
86 | +extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *); | |
87 | extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | |
88 | ||
89 | /* | |
90 | --- a/ipc/mqueue.c | |
91 | +++ b/ipc/mqueue.c | |
92 | @@ -746,7 +746,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __ | |
93 | err = mnt_want_write(mqueue_mnt); | |
94 | if (err) | |
95 | goto out_err; | |
96 | - err = vfs_unlink(dentry->d_parent->d_inode, dentry); | |
97 | + err = vfs_unlink(dentry->d_parent->d_inode, dentry, mqueue_mnt); | |
98 | mnt_drop_write(mqueue_mnt); | |
99 | out_err: | |
100 | dput(dentry); |