]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.apparmor/vfs-symlink.diff
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.apparmor / vfs-symlink.diff
CommitLineData
4d1e5b62
AF
1From: Tony Jones <tonyj@suse.de>
2Subject: Add a struct vfsmount parameter to vfs_symlink()
3
4The vfsmount will be passed down to the LSM hook so that LSMs can compute
5pathnames.
6
7Signed-off-by: Tony Jones <tonyj@suse.de>
8Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9Signed-off-by: John Johansen <jjohansen@suse.de>
10
11---
12 fs/ecryptfs/inode.c | 4 +++-
13 fs/namei.c | 5 +++--
14 fs/nfsd/vfs.c | 12 ++++++++----
15 include/linux/fs.h | 2 +-
16 4 files changed, 15 insertions(+), 8 deletions(-)
17
18--- a/fs/ecryptfs/inode.c
19+++ b/fs/ecryptfs/inode.c
20@@ -464,6 +464,7 @@ static int ecryptfs_symlink(struct inode
21 {
22 int rc;
23 struct dentry *lower_dentry;
24+ struct vfsmount *lower_mnt;
25 struct dentry *lower_dir_dentry;
26 char *encoded_symname;
27 int encoded_symlen;
28@@ -471,6 +472,7 @@ static int ecryptfs_symlink(struct inode
29
30 lower_dentry = ecryptfs_dentry_to_lower(dentry);
31 dget(lower_dentry);
32+ lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
33 lower_dir_dentry = lock_parent(lower_dentry);
34 encoded_symlen = ecryptfs_encode_filename(crypt_stat, symname,
35 strlen(symname),
36@@ -479,7 +481,7 @@ static int ecryptfs_symlink(struct inode
37 rc = encoded_symlen;
38 goto out_lock;
39 }
40- rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
41+ rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry, lower_mnt,
42 encoded_symname);
43 kfree(encoded_symname);
44 if (rc || !lower_dentry->d_inode)
45--- a/fs/namei.c
46+++ b/fs/namei.c
47@@ -2347,7 +2347,8 @@ SYSCALL_DEFINE1(unlink, const char __use
48 return do_unlinkat(AT_FDCWD, pathname);
49 }
50
51-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
52+int vfs_symlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
53+ const char *oldname)
54 {
55 int error = may_create(dir, dentry, 0);
56
57@@ -2393,7 +2394,7 @@ SYSCALL_DEFINE3(symlinkat, const char __
58 error = mnt_want_write(nd.path.mnt);
59 if (error)
60 goto out_dput;
61- error = vfs_symlink(nd.path.dentry->d_inode, dentry, from);
62+ error = vfs_symlink(nd.path.dentry->d_inode, dentry, nd.path.mnt, from);
63 mnt_drop_write(nd.path.mnt);
64 out_dput:
65 dput(dentry);
66--- a/fs/nfsd/vfs.c
67+++ b/fs/nfsd/vfs.c
68@@ -1545,6 +1545,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
69 struct iattr *iap)
70 {
71 struct dentry *dentry, *dnew;
72+ struct svc_export *exp;
73 __be32 err, cerr;
74 int host_err;
75
76@@ -1569,6 +1570,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
77 if (host_err)
78 goto out_nfserr;
79
80+ exp = fhp->fh_export;
81 if (unlikely(path[plen] != 0)) {
82 char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
83 if (path_alloced == NULL)
84@@ -1576,14 +1578,16 @@ nfsd_symlink(struct svc_rqst *rqstp, str
85 else {
86 strncpy(path_alloced, path, plen);
87 path_alloced[plen] = 0;
88- host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced);
89+ host_err = vfs_symlink(dentry->d_inode, dnew,
90+ exp->ex_path.mnt, path_alloced);
91 kfree(path_alloced);
92 }
93 } else
94- host_err = vfs_symlink(dentry->d_inode, dnew, path);
95+ host_err = vfs_symlink(dentry->d_inode, dnew, exp->ex_path.mnt,
96+ path);
97
98 if (!host_err) {
99- if (EX_ISSYNC(fhp->fh_export))
100+ if (EX_ISSYNC(exp))
101 host_err = nfsd_sync_dir(dentry);
102 }
103 err = nfserrno(host_err);
104@@ -1591,7 +1595,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
105
106 mnt_drop_write(fhp->fh_export->ex_path.mnt);
107
108- cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp);
109+ cerr = fh_compose(resfhp, exp, dnew, fhp);
110 dput(dnew);
111 if (err==0) err = cerr;
112 out:
113--- a/include/linux/fs.h
114+++ b/include/linux/fs.h
115@@ -1180,7 +1180,7 @@ extern int vfs_permission(struct nameida
116 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
117 extern int vfs_mkdir(struct inode *, struct dentry *, struct vfsmount *, int);
118 extern int vfs_mknod(struct inode *, struct dentry *, struct vfsmount *, int, dev_t);
119-extern int vfs_symlink(struct inode *, struct dentry *, const char *);
120+extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *);
121 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
122 extern int vfs_rmdir(struct inode *, struct dentry *);
123 extern int vfs_unlink(struct inode *, struct dentry *);