diff options
Diffstat (limited to 'fs/reiserfs/xattr_security.c')
-rw-r--r-- | fs/reiserfs/xattr_security.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index a92c8792c0f6..7271a477c041 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
@@ -3,41 +3,43 @@ | |||
3 | #include <linux/fs.h> | 3 | #include <linux/fs.h> |
4 | #include <linux/pagemap.h> | 4 | #include <linux/pagemap.h> |
5 | #include <linux/xattr.h> | 5 | #include <linux/xattr.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/reiserfs_xattr.h> | 7 | #include <linux/reiserfs_xattr.h> |
7 | #include <linux/security.h> | 8 | #include <linux/security.h> |
8 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
9 | 10 | ||
10 | static int | 11 | static int |
11 | security_get(struct inode *inode, const char *name, void *buffer, size_t size) | 12 | security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, |
13 | int handler_flags) | ||
12 | { | 14 | { |
13 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 15 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
14 | return -EINVAL; | 16 | return -EINVAL; |
15 | 17 | ||
16 | if (IS_PRIVATE(inode)) | 18 | if (IS_PRIVATE(dentry->d_inode)) |
17 | return -EPERM; | 19 | return -EPERM; |
18 | 20 | ||
19 | return reiserfs_xattr_get(inode, name, buffer, size); | 21 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); |
20 | } | 22 | } |
21 | 23 | ||
22 | static int | 24 | static int |
23 | security_set(struct inode *inode, const char *name, const void *buffer, | 25 | security_set(struct dentry *dentry, const char *name, const void *buffer, |
24 | size_t size, int flags) | 26 | size_t size, int flags, int handler_flags) |
25 | { | 27 | { |
26 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 28 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
27 | return -EINVAL; | 29 | return -EINVAL; |
28 | 30 | ||
29 | if (IS_PRIVATE(inode)) | 31 | if (IS_PRIVATE(dentry->d_inode)) |
30 | return -EPERM; | 32 | return -EPERM; |
31 | 33 | ||
32 | return reiserfs_xattr_set(inode, name, buffer, size, flags); | 34 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); |
33 | } | 35 | } |
34 | 36 | ||
35 | static size_t security_list(struct inode *inode, char *list, size_t list_len, | 37 | static size_t security_list(struct dentry *dentry, char *list, size_t list_len, |
36 | const char *name, size_t namelen) | 38 | const char *name, size_t namelen, int handler_flags) |
37 | { | 39 | { |
38 | const size_t len = namelen + 1; | 40 | const size_t len = namelen + 1; |
39 | 41 | ||
40 | if (IS_PRIVATE(inode)) | 42 | if (IS_PRIVATE(dentry->d_inode)) |
41 | return 0; | 43 | return 0; |
42 | 44 | ||
43 | if (list && len <= list_len) { | 45 | if (list && len <= list_len) { |
@@ -75,7 +77,7 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode, | |||
75 | return error; | 77 | return error; |
76 | } | 78 | } |
77 | 79 | ||
78 | if (sec->length) { | 80 | if (sec->length && reiserfs_xattrs_initialized(inode->i_sb)) { |
79 | blocks = reiserfs_xattr_jcreate_nblocks(inode) + | 81 | blocks = reiserfs_xattr_jcreate_nblocks(inode) + |
80 | reiserfs_xattr_nblocks(inode, sec->length); | 82 | reiserfs_xattr_nblocks(inode, sec->length); |
81 | /* We don't want to count the directories twice if we have | 83 | /* We don't want to count the directories twice if we have |