aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/tomoyo/mount.c')
-rw-r--r--security/tomoyo/mount.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/security/tomoyo/mount.c b/security/tomoyo/mount.c
index 7649dbc6a56b..1e610f96c99d 100644
--- a/security/tomoyo/mount.c
+++ b/security/tomoyo/mount.c
@@ -243,56 +243,3 @@ int tomoyo_mount_permission(char *dev_name, struct path *path,
243 tomoyo_read_unlock(idx); 243 tomoyo_read_unlock(idx);
244 return error; 244 return error;
245} 245}
246
247/**
248 * tomoyo_same_mount_acl - Check for duplicated "struct tomoyo_mount_acl" entry.
249 *
250 * @a: Pointer to "struct tomoyo_acl_info".
251 * @b: Pointer to "struct tomoyo_acl_info".
252 *
253 * Returns true if @a == @b, false otherwise.
254 */
255static bool tomoyo_same_mount_acl(const struct tomoyo_acl_info *a,
256 const struct tomoyo_acl_info *b)
257{
258 const struct tomoyo_mount_acl *p1 = container_of(a, typeof(*p1), head);
259 const struct tomoyo_mount_acl *p2 = container_of(b, typeof(*p2), head);
260 return tomoyo_same_name_union(&p1->dev_name, &p2->dev_name) &&
261 tomoyo_same_name_union(&p1->dir_name, &p2->dir_name) &&
262 tomoyo_same_name_union(&p1->fs_type, &p2->fs_type) &&
263 tomoyo_same_number_union(&p1->flags, &p2->flags);
264}
265
266/**
267 * tomoyo_write_mount - Write "struct tomoyo_mount_acl" list.
268 *
269 * @data: String to parse.
270 * @domain: Pointer to "struct tomoyo_domain_info".
271 * @is_delete: True if it is a delete request.
272 *
273 * Returns 0 on success, negative value otherwise.
274 *
275 * Caller holds tomoyo_read_lock().
276 */
277int tomoyo_write_mount(char *data, struct tomoyo_domain_info *domain,
278 const bool is_delete)
279{
280 struct tomoyo_mount_acl e = { .head.type = TOMOYO_TYPE_MOUNT_ACL };
281 int error = is_delete ? -ENOENT : -ENOMEM;
282 char *w[4];
283 if (!tomoyo_tokenize(data, w, sizeof(w)) || !w[3][0])
284 return -EINVAL;
285 if (!tomoyo_parse_name_union(w[0], &e.dev_name) ||
286 !tomoyo_parse_name_union(w[1], &e.dir_name) ||
287 !tomoyo_parse_name_union(w[2], &e.fs_type) ||
288 !tomoyo_parse_number_union(w[3], &e.flags))
289 goto out;
290 error = tomoyo_update_domain(&e.head, sizeof(e), is_delete, domain,
291 tomoyo_same_mount_acl, NULL);
292 out:
293 tomoyo_put_name_union(&e.dev_name);
294 tomoyo_put_name_union(&e.dir_name);
295 tomoyo_put_name_union(&e.fs_type);
296 tomoyo_put_number_union(&e.flags);
297 return error;
298}