~ubuntu-branches/ubuntu/natty/apparmor/natty-updates

« back to all changes in this revision

Viewing changes to deprecated/kernel-patches/2.6.28/vfs-setxattr.diff

  • Committer: Bazaar Package Importer
  • Author(s): Steve Beattie, Steve Beattie, Jamie Strandboge
  • Date: 2011-02-24 01:41:58 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20110224014158-jgxhztjm8ljtquxt
Tags: 2.6.0-0ubuntu1
[ Steve Beattie ]
* New upstream 2.6.0 release (LP: #724193)
  - Patches taken upstream and dropped:
    + 0001-ubuntu-buildd.patch
    + 0003-add-libvirt-support-to-dnsmasq.patch
    + 0004-lp698194.patch
    + 0005-aa-disable.patch
  - debian/rules: remove library path settings for mod_apparmor and
    pam_apprmor builds; upstream handles this properly now.
  - debian/apparmor-utils.install: handle upstream SubDomain.pm =>
    AppArmor.pm renaming
* debian/lib/apparmor/functions: handle profile names with embedded
  spaces (LP: #655523)
* debian/rules, debian/control, debian/python-libapparmor: build
  a python-libapparmor package.

[ Jamie Strandboge ]
* debian/copyright: update and reformat according to DEP-5
* debian/lib/apparmor/functions: don't unload dynamically generated libvirt
  profiles on reload, restart, and force-reload (LP: #702774)
* debian/control: use Section: python for python-libapparmor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Tony Jones <tonyj@suse.de>
2
 
Subject: Add a struct vfsmount parameter to vfs_setxattr()
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/nfsd/vfs.c         |   16 +++++++++++-----
13
 
 fs/xattr.c            |   16 ++++++++--------
14
 
 include/linux/xattr.h |    3 ++-
15
 
 3 files changed, 21 insertions(+), 14 deletions(-)
16
 
 
17
 
--- a/fs/nfsd/vfs.c
18
 
+++ b/fs/nfsd/vfs.c
19
 
@@ -429,7 +429,8 @@ static ssize_t nfsd_getxattr(struct dent
20
 
 
21
 
 #if defined(CONFIG_NFSD_V4)
22
 
 static int
23
 
-set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key)
24
 
+set_nfsv4_acl_one(struct dentry *dentry, struct vfsmount *mnt,
25
 
+                 struct posix_acl *pacl, char *key)
26
 
 {
27
 
        int len;
28
 
        size_t buflen;
29
 
@@ -448,7 +449,7 @@ set_nfsv4_acl_one(struct dentry *dentry,
30
 
                goto out;
31
 
        }
32
 
 
33
 
-       error = vfs_setxattr(dentry, key, buf, len, 0);
34
 
+       error = vfs_setxattr(dentry, mnt, key, buf, len, 0);
35
 
 out:
36
 
        kfree(buf);
37
 
        return error;
38
 
@@ -461,6 +462,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqst
39
 
        __be32 error;
40
 
        int host_error;
41
 
        struct dentry *dentry;
42
 
+       struct vfsmount *mnt;
43
 
        struct inode *inode;
44
 
        struct posix_acl *pacl = NULL, *dpacl = NULL;
45
 
        unsigned int flags = 0;
46
 
@@ -471,6 +473,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqst
47
 
                return error;
48
 
 
49
 
        dentry = fhp->fh_dentry;
50
 
+       mnt = fhp->fh_export->ex_path.mnt;
51
 
        inode = dentry->d_inode;
52
 
        if (S_ISDIR(inode->i_mode))
53
 
                flags = NFS4_ACL_DIR;
54
 
@@ -481,12 +484,14 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqst
55
 
        } else if (host_error < 0)
56
 
                goto out_nfserr;
57
 
 
58
 
-       host_error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS);
59
 
+       host_error = set_nfsv4_acl_one(dentry, mnt, pacl,
60
 
+                                      POSIX_ACL_XATTR_ACCESS);
61
 
        if (host_error < 0)
62
 
                goto out_release;
63
 
 
64
 
        if (S_ISDIR(inode->i_mode))
65
 
-               host_error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT);
66
 
+               host_error = set_nfsv4_acl_one(dentry, mnt, dpacl,
67
 
+                                              POSIX_ACL_XATTR_DEFAULT);
68
 
 
69
 
 out_release:
70
 
        posix_acl_release(pacl);
71
 
@@ -2202,7 +2207,8 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
72
 
        if (error)
73
 
                goto getout;
74
 
        if (size)
75
 
-               error = vfs_setxattr(fhp->fh_dentry, name, value, size, 0);
76
 
+               error = vfs_setxattr(fhp->fh_dentry, fhp->fh_export->ex_path.mnt,
77
 
+                                    name, value, size,0);
78
 
        else {
79
 
                if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT)
80
 
                        error = 0;
81
 
--- a/fs/xattr.c
82
 
+++ b/fs/xattr.c
83
 
@@ -67,8 +67,8 @@ xattr_permission(struct inode *inode, co
84
 
 }
85
 
 
86
 
 int
87
 
-vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
88
 
-               size_t size, int flags)
89
 
+vfs_setxattr(struct dentry *dentry, struct vfsmount *mnt, const char *name,
90
 
+            const void *value, size_t size, int flags)
91
 
 {
92
 
        struct inode *inode = dentry->d_inode;
93
 
        int error;
94
 
@@ -218,8 +218,8 @@ EXPORT_SYMBOL_GPL(vfs_removexattr);
95
 
  * Extended attribute SET operations
96
 
  */
97
 
 static long
98
 
-setxattr(struct dentry *d, const char __user *name, const void __user *value,
99
 
-        size_t size, int flags)
100
 
+setxattr(struct dentry *dentry, struct vfsmount *mnt, const char __user *name,
101
 
+        const void __user *value, size_t size, int flags)
102
 
 {
103
 
        int error;
104
 
        void *kvalue = NULL;
105
 
@@ -246,7 +246,7 @@ setxattr(struct dentry *d, const char __
106
 
                }
107
 
        }
108
 
 
109
 
-       error = vfs_setxattr(d, kname, kvalue, size, flags);
110
 
+       error = vfs_setxattr(dentry, mnt, kname, kvalue, size, flags);
111
 
        kfree(kvalue);
112
 
        return error;
113
 
 }
114
 
@@ -263,7 +263,7 @@ sys_setxattr(const char __user *pathname
115
 
                return error;
116
 
        error = mnt_want_write(path.mnt);
117
 
        if (!error) {
118
 
-               error = setxattr(path.dentry, name, value, size, flags);
119
 
+               error = setxattr(path.dentry, path.mnt, name, value, size, flags);
120
 
                mnt_drop_write(path.mnt);
121
 
        }
122
 
        path_put(&path);
123
 
@@ -282,7 +282,7 @@ sys_lsetxattr(const char __user *pathnam
124
 
                return error;
125
 
        error = mnt_want_write(path.mnt);
126
 
        if (!error) {
127
 
-               error = setxattr(path.dentry, name, value, size, flags);
128
 
+               error = setxattr(path.dentry, path.mnt, name, value, size, flags);
129
 
                mnt_drop_write(path.mnt);
130
 
        }
131
 
        path_put(&path);
132
 
@@ -304,7 +304,7 @@ sys_fsetxattr(int fd, const char __user
133
 
        audit_inode(NULL, dentry);
134
 
        error = mnt_want_write(f->f_path.mnt);
135
 
        if (!error) {
136
 
-               error = setxattr(dentry, name, value, size, flags);
137
 
+               error = setxattr(dentry, f->f_vfsmnt, name, value, size, flags);
138
 
                mnt_drop_write(f->f_path.mnt);
139
 
        }
140
 
        fput(f);
141
 
--- a/include/linux/xattr.h
142
 
+++ b/include/linux/xattr.h
143
 
@@ -16,6 +16,7 @@
144
 
 #ifdef  __KERNEL__
145
 
 
146
 
 #include <linux/types.h>
147
 
+#include <linux/mount.h>
148
 
 
149
 
 /* Namespaces */
150
 
 #define XATTR_OS2_PREFIX "os2."
151
 
@@ -49,7 +50,7 @@ struct xattr_handler {
152
 
 ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
153
 
 ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
154
 
 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
155
 
-int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
156
 
+int vfs_setxattr(struct dentry *, struct vfsmount *, const char *, const void *, size_t, int);
157
 
 int vfs_removexattr(struct dentry *, const char *);
158
 
 
159
 
 ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);