~ubuntu-branches/ubuntu/oneiric/apparmor/oneiric-security

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/security-getxattr.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
 
Pass struct vfsmount to the inode_getxattr LSM hook
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
 
@@ -117,7 +117,7 @@ vfs_getxattr(struct dentry *dentry, stru
11
 
        if (error)
12
 
                return error;
13
 
 
14
 
-       error = security_inode_getxattr(dentry, name);
15
 
+       error = security_inode_getxattr(dentry, mnt, name);
16
 
        if (error)
17
 
                return error;
18
 
 
19
 
Index: b/include/linux/security.h
20
 
===================================================================
21
 
--- a/include/linux/security.h
22
 
+++ b/include/linux/security.h
23
 
@@ -391,7 +391,7 @@ struct request_sock;
24
 
  *     @value identified by @name for @dentry and @mnt.
25
 
  * @inode_getxattr:
26
 
  *     Check permission before obtaining the extended attributes
27
 
- *     identified by @name for @dentry.
28
 
+ *     identified by @name for @dentry and @mnt.
29
 
  *     Return 0 if permission is granted.
30
 
  * @inode_listxattr:
31
 
  *     Check permission before obtaining the list of extended attribute 
32
 
@@ -1248,7 +1248,8 @@ struct security_operations {
33
 
                                     struct vfsmount *mnt,
34
 
                                     char *name, void *value,
35
 
                                     size_t size, int flags);
36
 
-       int (*inode_getxattr) (struct dentry *dentry, char *name);
37
 
+       int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt,
38
 
+                              char *name);
39
 
        int (*inode_listxattr) (struct dentry *dentry);
40
 
        int (*inode_removexattr) (struct dentry *dentry, char *name);
41
 
        const char *(*inode_xattr_getsuffix) (void);
42
 
@@ -1782,11 +1783,12 @@ static inline void security_inode_post_s
43
 
        security_ops->inode_post_setxattr (dentry, mnt, name, value, size, flags);
44
 
 }
45
 
 
46
 
-static inline int security_inode_getxattr (struct dentry *dentry, char *name)
47
 
+static inline int security_inode_getxattr (struct dentry *dentry,
48
 
+                                           struct vfsmount *mnt, char *name)
49
 
 {
50
 
        if (unlikely (IS_PRIVATE (dentry->d_inode)))
51
 
                return 0;
52
 
-       return security_ops->inode_getxattr (dentry, name);
53
 
+       return security_ops->inode_getxattr (dentry, mnt, name);
54
 
 }
55
 
 
56
 
 static inline int security_inode_listxattr (struct dentry *dentry)
57
 
@@ -2487,7 +2489,8 @@ static inline void security_inode_post_s
58
 
                                                 int flags)
59
 
 { }
60
 
 
61
 
-static inline int security_inode_getxattr (struct dentry *dentry, char *name)
62
 
+static inline int security_inode_getxattr (struct dentry *dentry,
63
 
+                                           struct vfsmount *mnt, char *name)
64
 
 {
65
 
        return 0;
66
 
 }
67
 
Index: b/security/dummy.c
68
 
===================================================================
69
 
--- a/security/dummy.c
70
 
+++ b/security/dummy.c
71
 
@@ -368,7 +368,8 @@ static void dummy_inode_post_setxattr (s
72
 
 {
73
 
 }
74
 
 
75
 
-static int dummy_inode_getxattr (struct dentry *dentry, char *name)
76
 
+static int dummy_inode_getxattr (struct dentry *dentry,
77
 
+                                 struct vfsmount *mnt, char *name)
78
 
 {
79
 
        return 0;
80
 
 }
81
 
Index: b/security/selinux/hooks.c
82
 
===================================================================
83
 
--- a/security/selinux/hooks.c
84
 
+++ b/security/selinux/hooks.c
85
 
@@ -2395,7 +2395,8 @@ static void selinux_inode_post_setxattr(
86
 
        return;
87
 
 }
88
 
 
89
 
-static int selinux_inode_getxattr (struct dentry *dentry, char *name)
90
 
+static int selinux_inode_getxattr (struct dentry *dentry, struct vfsmount *mnt,
91
 
+                                  char *name)
92
 
 {
93
 
        return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);
94
 
 }