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

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/vfs-listxattr.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_listxattr()
2
 
 
3
 
Signed-off-by: Tony Jones <tonyj@suse.de>
4
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
5
 
 
6
 
Index: b/fs/xattr.c
7
 
===================================================================
8
 
--- a/fs/xattr.c
9
 
+++ b/fs/xattr.c
10
 
@@ -144,18 +144,20 @@ vfs_getxattr(struct dentry *dentry, stru
11
 
 EXPORT_SYMBOL_GPL(vfs_getxattr);
12
 
 
13
 
 ssize_t
14
 
-vfs_listxattr(struct dentry *d, char *list, size_t size)
15
 
+vfs_listxattr(struct dentry *dentry, struct vfsmount *mnt, char *list,
16
 
+             size_t size)
17
 
 {
18
 
+       struct inode *inode = dentry->d_inode;
19
 
        ssize_t error;
20
 
 
21
 
-       error = security_inode_listxattr(d);
22
 
+       error = security_inode_listxattr(dentry);
23
 
        if (error)
24
 
                return error;
25
 
        error = -EOPNOTSUPP;
26
 
-       if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
27
 
-               error = d->d_inode->i_op->listxattr(d, list, size);
28
 
-       } else {
29
 
-               error = security_inode_listsecurity(d->d_inode, list, size);
30
 
+       if (inode->i_op && inode->i_op->listxattr)
31
 
+               error = inode->i_op->listxattr(dentry, list, size);
32
 
+       else {
33
 
+               error = security_inode_listsecurity(inode, list, size);
34
 
                if (size && error > size)
35
 
                        error = -ERANGE;
36
 
        }
37
 
@@ -362,7 +364,8 @@ sys_fgetxattr(int fd, char __user *name,
38
 
  * Extended attribute LIST operations
39
 
  */
40
 
 static ssize_t
41
 
-listxattr(struct dentry *d, char __user *list, size_t size)
42
 
+listxattr(struct dentry *dentry, struct vfsmount *mnt, char __user *list,
43
 
+         size_t size)
44
 
 {
45
 
        ssize_t error;
46
 
        char *klist = NULL;
47
 
@@ -375,7 +378,7 @@ listxattr(struct dentry *d, char __user 
48
 
                        return -ENOMEM;
49
 
        }
50
 
 
51
 
-       error = vfs_listxattr(d, klist, size);
52
 
+       error = vfs_listxattr(dentry, mnt, klist, size);
53
 
        if (error > 0) {
54
 
                if (size && copy_to_user(list, klist, error))
55
 
                        error = -EFAULT;
56
 
@@ -397,7 +400,7 @@ sys_listxattr(char __user *path, char __
57
 
        error = user_path_walk(path, &nd);
58
 
        if (error)
59
 
                return error;
60
 
-       error = listxattr(nd.dentry, list, size);
61
 
+       error = listxattr(nd.dentry, nd.mnt, list, size);
62
 
        path_release(&nd);
63
 
        return error;
64
 
 }
65
 
@@ -411,7 +414,7 @@ sys_llistxattr(char __user *path, char _
66
 
        error = user_path_walk_link(path, &nd);
67
 
        if (error)
68
 
                return error;
69
 
-       error = listxattr(nd.dentry, list, size);
70
 
+       error = listxattr(nd.dentry, nd.mnt, list, size);
71
 
        path_release(&nd);
72
 
        return error;
73
 
 }
74
 
@@ -425,7 +428,7 @@ sys_flistxattr(int fd, char __user *list
75
 
        f = fget(fd);
76
 
        if (!f)
77
 
                return error;
78
 
-       error = listxattr(f->f_path.dentry, list, size);
79
 
+       error = listxattr(f->f_path.dentry, f->f_path.mnt, list, size);
80
 
        fput(f);
81
 
        return error;
82
 
 }
83
 
Index: b/include/linux/xattr.h
84
 
===================================================================
85
 
--- a/include/linux/xattr.h
86
 
+++ b/include/linux/xattr.h
87
 
@@ -48,7 +48,8 @@ struct xattr_handler {
88
 
 
89
 
 ssize_t vfs_getxattr(struct dentry *, struct vfsmount *, char *, void *,
90
 
                     size_t);
91
 
-ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
92
 
+ssize_t vfs_listxattr(struct dentry *d, struct vfsmount *, char *list,
93
 
+                     size_t size);
94
 
 int vfs_setxattr(struct dentry *, struct vfsmount *, char *, void *, size_t,
95
 
                 int);
96
 
 int vfs_removexattr(struct dentry *, char *);