~apparmor-dev/apparmor/2_3

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/security-getxattr.diff

  • Committer: jrjohansen
  • Date: 2008-05-27 12:04:33 UTC
  • Revision ID: svn-v4:40609528-9d10-0410-9bd8-e926d5471da9:branches/2_3:1265
remove for-mainline dir from kernel patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Tony Jones <tonyj@suse.de>
2
 
Subject: Pass struct vfsmount to the inode_getxattr LSM hook
3
 
 
4
 
This is needed for computing pathnames in the AppArmor LSM.
5
 
 
6
 
Signed-off-by: Tony Jones <tonyj@suse.de>
7
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
8
 
Signed-off-by: John Johansen <jjohansen@suse.de>
9
 
 
10
 
---
11
 
 fs/xattr.c               |    2 +-
12
 
 include/linux/security.h |   11 +++++++----
13
 
 security/dummy.c         |    3 ++-
14
 
 security/security.c      |    5 +++--
15
 
 security/selinux/hooks.c |    3 ++-
16
 
 5 files changed, 15 insertions(+), 9 deletions(-)
17
 
 
18
 
--- a/fs/xattr.c
19
 
+++ b/fs/xattr.c
20
 
@@ -115,7 +115,7 @@ vfs_getxattr(struct dentry *dentry, stru
21
 
        if (error)
22
 
                return error;
23
 
 
24
 
-       error = security_inode_getxattr(dentry, name);
25
 
+       error = security_inode_getxattr(dentry, mnt, name);
26
 
        if (error)
27
 
                return error;
28
 
 
29
 
--- a/include/linux/security.h
30
 
+++ b/include/linux/security.h
31
 
@@ -405,7 +405,7 @@ struct request_sock;
32
 
  *     @value identified by @name for @dentry and @mnt.
33
 
  * @inode_getxattr:
34
 
  *     Check permission before obtaining the extended attributes
35
 
- *     identified by @name for @dentry.
36
 
+ *     identified by @name for @dentry and @mnt.
37
 
  *     Return 0 if permission is granted.
38
 
  * @inode_listxattr:
39
 
  *     Check permission before obtaining the list of extended attribute 
40
 
@@ -1291,7 +1291,8 @@ struct security_operations {
41
 
                                     struct vfsmount *mnt,
42
 
                                     char *name, void *value,
43
 
                                     size_t size, int flags);
44
 
-       int (*inode_getxattr) (struct dentry *dentry, char *name);
45
 
+       int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt,
46
 
+                              char *name);
47
 
        int (*inode_listxattr) (struct dentry *dentry);
48
 
        int (*inode_removexattr) (struct dentry *dentry, char *name);
49
 
        int (*inode_need_killpriv) (struct dentry *dentry);
50
 
@@ -1554,7 +1555,8 @@ int security_inode_setxattr(struct dentr
51
 
 void security_inode_post_setxattr(struct dentry *dentry, struct vfsmount *mnt,
52
 
                                  char *name, void *value, size_t size,
53
 
                                  int flags);
54
 
-int security_inode_getxattr(struct dentry *dentry, char *name);
55
 
+int security_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
56
 
+                           char *name);
57
 
 int security_inode_listxattr(struct dentry *dentry);
58
 
 int security_inode_removexattr(struct dentry *dentry, char *name);
59
 
 int security_inode_need_killpriv(struct dentry *dentry);
60
 
@@ -1954,7 +1956,8 @@ static inline void security_inode_post_s
61
 
                                                 int flags)
62
 
 { }
63
 
 
64
 
-static inline int security_inode_getxattr (struct dentry *dentry, char *name)
65
 
+static inline int security_inode_getxattr (struct dentry *dentry,
66
 
+                                           struct vfsmount *mnt, char *name)
67
 
 {
68
 
        return 0;
69
 
 }
70
 
--- a/security/dummy.c
71
 
+++ b/security/dummy.c
72
 
@@ -365,7 +365,8 @@ static void dummy_inode_post_setxattr (s
73
 
 {
74
 
 }
75
 
 
76
 
-static int dummy_inode_getxattr (struct dentry *dentry, char *name)
77
 
+static int dummy_inode_getxattr (struct dentry *dentry,
78
 
+                                 struct vfsmount *mnt, char *name)
79
 
 {
80
 
        return 0;
81
 
 }
82
 
--- a/security/security.c
83
 
+++ b/security/security.c
84
 
@@ -458,11 +458,12 @@ void security_inode_post_setxattr(struct
85
 
        security_ops->inode_post_setxattr(dentry, mnt, name, value, size, flags);
86
 
 }
87
 
 
88
 
-int security_inode_getxattr(struct dentry *dentry, char *name)
89
 
+int security_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
90
 
+                           char *name)
91
 
 {
92
 
        if (unlikely(IS_PRIVATE(dentry->d_inode)))
93
 
                return 0;
94
 
-       return security_ops->inode_getxattr(dentry, name);
95
 
+       return security_ops->inode_getxattr(dentry, mnt, name);
96
 
 }
97
 
 
98
 
 int security_inode_listxattr(struct dentry *dentry)
99
 
--- a/security/selinux/hooks.c
100
 
+++ b/security/selinux/hooks.c
101
 
@@ -2409,7 +2409,8 @@ static void selinux_inode_post_setxattr(
102
 
        return;
103
 
 }
104
 
 
105
 
-static int selinux_inode_getxattr (struct dentry *dentry, char *name)
106
 
+static int selinux_inode_getxattr (struct dentry *dentry, struct vfsmount *mnt,
107
 
+                                  char *name)
108
 
 {
109
 
        return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);
110
 
 }