~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/vfs-symlink.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Add a struct vfsmount parameter to vfs_symlink()
2
 
 
3
 
Signed-off-by: Tony Jones <tonyj@suse.de>
4
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
5
 
 
6
 
Index: b/fs/ecryptfs/inode.c
7
 
===================================================================
8
 
--- a/fs/ecryptfs/inode.c
9
 
+++ b/fs/ecryptfs/inode.c
10
 
@@ -473,6 +473,7 @@ static int ecryptfs_symlink(struct inode
11
 
 {
12
 
        int rc;
13
 
        struct dentry *lower_dentry;
14
 
+       struct vfsmount *lower_mnt;
15
 
        struct dentry *lower_dir_dentry;
16
 
        umode_t mode;
17
 
        char *encoded_symname;
18
 
@@ -481,6 +482,7 @@ static int ecryptfs_symlink(struct inode
19
 
 
20
 
        lower_dentry = ecryptfs_dentry_to_lower(dentry);
21
 
        dget(lower_dentry);
22
 
+       lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
23
 
        lower_dir_dentry = lock_parent(lower_dentry);
24
 
        mode = S_IALLUGO;
25
 
        encoded_symlen = ecryptfs_encode_filename(crypt_stat, symname,
26
 
@@ -490,7 +492,7 @@ static int ecryptfs_symlink(struct inode
27
 
                rc = encoded_symlen;
28
 
                goto out_lock;
29
 
        }
30
 
-       rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
31
 
+       rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry, lower_mnt,
32
 
                         encoded_symname, mode);
33
 
        kfree(encoded_symname);
34
 
        if (rc || !lower_dentry->d_inode)
35
 
Index: b/fs/namei.c
36
 
===================================================================
37
 
--- a/fs/namei.c
38
 
+++ b/fs/namei.c
39
 
@@ -2185,7 +2185,8 @@ asmlinkage long sys_unlink(const char __
40
 
        return do_unlinkat(AT_FDCWD, pathname);
41
 
 }
42
 
 
43
 
-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
44
 
+int vfs_symlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
45
 
+               const char *oldname, int mode)
46
 
 {
47
 
        int error = may_create(dir, dentry, NULL);
48
 
 
49
 
@@ -2231,7 +2232,8 @@ asmlinkage long sys_symlinkat(const char
50
 
        if (IS_ERR(dentry))
51
 
                goto out_unlock;
52
 
 
53
 
-       error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
54
 
+       error = vfs_symlink(nd.dentry->d_inode, dentry, nd.mnt, from,
55
 
+                           S_IALLUGO);
56
 
        dput(dentry);
57
 
 out_unlock:
58
 
        mutex_unlock(&nd.dentry->d_inode->i_mutex);
59
 
Index: b/fs/nfsd/vfs.c
60
 
===================================================================
61
 
--- a/fs/nfsd/vfs.c
62
 
+++ b/fs/nfsd/vfs.c
63
 
@@ -1432,6 +1432,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
64
 
                                struct iattr *iap)
65
 
 {
66
 
        struct dentry   *dentry, *dnew;
67
 
+       struct vfsmount *mnt;
68
 
        __be32          err, cerr;
69
 
        int             host_err;
70
 
        umode_t         mode;
71
 
@@ -1458,6 +1459,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
72
 
        if (iap && (iap->ia_valid & ATTR_MODE))
73
 
                mode = iap->ia_mode & S_IALLUGO;
74
 
 
75
 
+       mnt = fhp->fh_export->ex_mnt;
76
 
        if (unlikely(path[plen] != 0)) {
77
 
                char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
78
 
                if (path_alloced == NULL)
79
 
@@ -1465,11 +1467,12 @@ nfsd_symlink(struct svc_rqst *rqstp, str
80
 
                else {
81
 
                        strncpy(path_alloced, path, plen);
82
 
                        path_alloced[plen] = 0;
83
 
-                       host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
84
 
+                       host_err = vfs_symlink(dentry->d_inode, dnew, mnt,
85
 
+                                              path_alloced, mode);
86
 
                        kfree(path_alloced);
87
 
                }
88
 
        } else
89
 
-               host_err = vfs_symlink(dentry->d_inode, dnew, path, mode);
90
 
+               host_err = vfs_symlink(dentry->d_inode, dnew, mnt, path, mode);
91
 
 
92
 
        if (!host_err) {
93
 
                if (EX_ISSYNC(fhp->fh_export))
94
 
Index: b/include/linux/fs.h
95
 
===================================================================
96
 
--- a/include/linux/fs.h
97
 
+++ b/include/linux/fs.h
98
 
@@ -982,7 +982,7 @@ extern int vfs_permission(struct nameida
99
 
 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
100
 
 extern int vfs_mkdir(struct inode *, struct dentry *, struct vfsmount *, int);
101
 
 extern int vfs_mknod(struct inode *, struct dentry *, struct vfsmount *, int, dev_t);
102
 
-extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);
103
 
+extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *, int);
104
 
 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
105
 
 extern int vfs_rmdir(struct inode *, struct dentry *);
106
 
 extern int vfs_unlink(struct inode *, struct dentry *);