]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.suse/ocfs2-add-ocfs2_check_acl.patch
Revert "Disable build of xen kernel."
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / ocfs2-add-ocfs2_check_acl.patch
CommitLineData
00e5a55c
BS
1From: Tiger Yang <tiger.yang@oracle.com>
2Date: Fri, 14 Nov 2008 11:17:18 +0800
3Subject: ocfs2: add ocfs2_check_acl
4Patch-mainline: 2.6.29
5
6This function is used to enhance permission checking with POSIX ACLs.
7
8Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
9Signed-off-by: Mark Fasheh <mfasheh@suse.com>
10---
11 fs/ocfs2/acl.c | 15 +++++++++++++++
12 fs/ocfs2/acl.h | 10 ++++++++++
13 fs/ocfs2/file.c | 3 ++-
14 3 files changed, 27 insertions(+), 1 deletions(-)
15
16diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
17index 62d0faa..a6a2bf6 100644
18--- a/fs/ocfs2/acl.c
19+++ b/fs/ocfs2/acl.c
20@@ -230,6 +230,21 @@ static int ocfs2_set_acl(handle_t *handle,
21 return ret;
22 }
23
24+int ocfs2_check_acl(struct inode *inode, int mask)
25+{
26+ struct posix_acl *acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
27+
28+ if (IS_ERR(acl))
29+ return PTR_ERR(acl);
30+ if (acl) {
31+ int ret = posix_acl_permission(inode, acl, mask);
32+ posix_acl_release(acl);
33+ return ret;
34+ }
35+
36+ return -EAGAIN;
37+}
38+
39 static size_t ocfs2_xattr_list_acl_access(struct inode *inode,
40 char *list,
41 size_t list_len,
42diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
43index 1b39f3e..fef10f1 100644
44--- a/fs/ocfs2/acl.h
45+++ b/fs/ocfs2/acl.h
46@@ -26,4 +26,14 @@ struct ocfs2_acl_entry {
47 __le32 e_id;
48 };
49
50+#ifdef CONFIG_OCFS2_FS_POSIX_ACL
51+
52+extern int ocfs2_check_acl(struct inode *, int);
53+
54+#else /* CONFIG_OCFS2_FS_POSIX_ACL*/
55+
56+#define ocfs2_check_acl NULL
57+
58+#endif /* CONFIG_OCFS2_FS_POSIX_ACL*/
59+
60 #endif /* OCFS2_ACL_H */
61diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
62index 3605491..7bad7d9 100644
63--- a/fs/ocfs2/file.c
64+++ b/fs/ocfs2/file.c
65@@ -56,6 +56,7 @@
66 #include "suballoc.h"
67 #include "super.h"
68 #include "xattr.h"
69+#include "acl.h"
70
71 #include "buffer_head_io.h"
72
73@@ -1035,7 +1036,7 @@ int ocfs2_permission(struct inode *inode, int mask)
74 goto out;
75 }
76
77- ret = generic_permission(inode, mask, NULL);
78+ ret = generic_permission(inode, mask, ocfs2_check_acl);
79
80 ocfs2_inode_unlock(inode, 0);
81 out:
82--
831.5.6
84