diff options
Diffstat (limited to 'fs/9p/xattr_security.c')
-rw-r--r-- | fs/9p/xattr_security.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/fs/9p/xattr_security.c b/fs/9p/xattr_security.c deleted file mode 100644 index c0a470add13c..000000000000 --- a/fs/9p/xattr_security.c +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright IBM Corporation, 2010 | ||
3 | * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of version 2.1 of the GNU Lesser General Public License | ||
7 | * as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it would be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/string.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include "xattr.h" | ||
21 | |||
22 | static int v9fs_xattr_security_get(const struct xattr_handler *handler, | ||
23 | struct dentry *dentry, const char *name, | ||
24 | void *buffer, size_t size) | ||
25 | { | ||
26 | int retval; | ||
27 | char *full_name; | ||
28 | size_t name_len; | ||
29 | size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; | ||
30 | |||
31 | if (name == NULL) | ||
32 | return -EINVAL; | ||
33 | |||
34 | if (strcmp(name, "") == 0) | ||
35 | return -EINVAL; | ||
36 | |||
37 | name_len = strlen(name); | ||
38 | full_name = kmalloc(prefix_len + name_len + 1 , GFP_KERNEL); | ||
39 | if (!full_name) | ||
40 | return -ENOMEM; | ||
41 | memcpy(full_name, XATTR_SECURITY_PREFIX, prefix_len); | ||
42 | memcpy(full_name+prefix_len, name, name_len); | ||
43 | full_name[prefix_len + name_len] = '\0'; | ||
44 | |||
45 | retval = v9fs_xattr_get(dentry, full_name, buffer, size); | ||
46 | kfree(full_name); | ||
47 | return retval; | ||
48 | } | ||
49 | |||
50 | static int v9fs_xattr_security_set(const struct xattr_handler *handler, | ||
51 | struct dentry *dentry, const char *name, | ||
52 | const void *value, size_t size, int flags) | ||
53 | { | ||
54 | int retval; | ||
55 | char *full_name; | ||
56 | size_t name_len; | ||
57 | size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; | ||
58 | |||
59 | if (name == NULL) | ||
60 | return -EINVAL; | ||
61 | |||
62 | if (strcmp(name, "") == 0) | ||
63 | return -EINVAL; | ||
64 | |||
65 | name_len = strlen(name); | ||
66 | full_name = kmalloc(prefix_len + name_len + 1 , GFP_KERNEL); | ||
67 | if (!full_name) | ||
68 | return -ENOMEM; | ||
69 | memcpy(full_name, XATTR_SECURITY_PREFIX, prefix_len); | ||
70 | memcpy(full_name + prefix_len, name, name_len); | ||
71 | full_name[prefix_len + name_len] = '\0'; | ||
72 | |||
73 | retval = v9fs_xattr_set(dentry, full_name, value, size, flags); | ||
74 | kfree(full_name); | ||
75 | return retval; | ||
76 | } | ||
77 | |||
78 | struct xattr_handler v9fs_xattr_security_handler = { | ||
79 | .prefix = XATTR_SECURITY_PREFIX, | ||
80 | .get = v9fs_xattr_security_get, | ||
81 | .set = v9fs_xattr_security_set, | ||
82 | }; | ||