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.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/security/tomoyo/mount.c b/security/tomoyo/mount.c
index 5cfc72078742..7649dbc6a56b 100644
--- a/security/tomoyo/mount.c
+++ b/security/tomoyo/mount.c
@@ -52,16 +52,28 @@ static int tomoyo_audit_mount_log(struct tomoyo_request_info *r)
52 r->param.mount.dir->name, type, flags); 52 r->param.mount.dir->name, type, flags);
53} 53}
54 54
55/**
56 * tomoyo_check_mount_acl - Check permission for path path path number operation.
57 *
58 * @r: Pointer to "struct tomoyo_request_info".
59 * @ptr: Pointer to "struct tomoyo_acl_info".
60 *
61 * Returns true if granted, false otherwise.
62 */
55static bool tomoyo_check_mount_acl(struct tomoyo_request_info *r, 63static bool tomoyo_check_mount_acl(struct tomoyo_request_info *r,
56 const struct tomoyo_acl_info *ptr) 64 const struct tomoyo_acl_info *ptr)
57{ 65{
58 const struct tomoyo_mount_acl *acl = 66 const struct tomoyo_mount_acl *acl =
59 container_of(ptr, typeof(*acl), head); 67 container_of(ptr, typeof(*acl), head);
60 return tomoyo_compare_number_union(r->param.mount.flags, &acl->flags) && 68 return tomoyo_compare_number_union(r->param.mount.flags,
61 tomoyo_compare_name_union(r->param.mount.type, &acl->fs_type) && 69 &acl->flags) &&
62 tomoyo_compare_name_union(r->param.mount.dir, &acl->dir_name) && 70 tomoyo_compare_name_union(r->param.mount.type,
71 &acl->fs_type) &&
72 tomoyo_compare_name_union(r->param.mount.dir,
73 &acl->dir_name) &&
63 (!r->param.mount.need_dev || 74 (!r->param.mount.need_dev ||
64 tomoyo_compare_name_union(r->param.mount.dev, &acl->dev_name)); 75 tomoyo_compare_name_union(r->param.mount.dev,
76 &acl->dev_name));
65} 77}
66 78
67/** 79/**
@@ -232,13 +244,20 @@ int tomoyo_mount_permission(char *dev_name, struct path *path,
232 return error; 244 return error;
233} 245}
234 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 */
235static bool tomoyo_same_mount_acl(const struct tomoyo_acl_info *a, 255static bool tomoyo_same_mount_acl(const struct tomoyo_acl_info *a,
236 const struct tomoyo_acl_info *b) 256 const struct tomoyo_acl_info *b)
237{ 257{
238 const struct tomoyo_mount_acl *p1 = container_of(a, typeof(*p1), head); 258 const struct tomoyo_mount_acl *p1 = container_of(a, typeof(*p1), head);
239 const struct tomoyo_mount_acl *p2 = container_of(b, typeof(*p2), head); 259 const struct tomoyo_mount_acl *p2 = container_of(b, typeof(*p2), head);
240 return tomoyo_same_acl_head(&p1->head, &p2->head) && 260 return tomoyo_same_name_union(&p1->dev_name, &p2->dev_name) &&
241 tomoyo_same_name_union(&p1->dev_name, &p2->dev_name) &&
242 tomoyo_same_name_union(&p1->dir_name, &p2->dir_name) && 261 tomoyo_same_name_union(&p1->dir_name, &p2->dir_name) &&
243 tomoyo_same_name_union(&p1->fs_type, &p2->fs_type) && 262 tomoyo_same_name_union(&p1->fs_type, &p2->fs_type) &&
244 tomoyo_same_number_union(&p1->flags, &p2->flags); 263 tomoyo_same_number_union(&p1->flags, &p2->flags);