tomoyo: ignore data race while checking quota
[linux-2.6-microblaze.git] / security / tomoyo / file.c
index 051f729..1e60775 100644 (file)
@@ -362,14 +362,14 @@ static bool tomoyo_merge_path_acl(struct tomoyo_acl_info *a,
 {
        u16 * const a_perm = &container_of(a, struct tomoyo_path_acl, head)
                ->perm;
-       u16 perm = *a_perm;
+       u16 perm = READ_ONCE(*a_perm);
        const u16 b_perm = container_of(b, struct tomoyo_path_acl, head)->perm;
 
        if (is_delete)
                perm &= ~b_perm;
        else
                perm |= b_perm;
-       *a_perm = perm;
+       WRITE_ONCE(*a_perm, perm);
        return !perm;
 }
 
@@ -437,7 +437,7 @@ static bool tomoyo_merge_mkdev_acl(struct tomoyo_acl_info *a,
 {
        u8 *const a_perm = &container_of(a, struct tomoyo_mkdev_acl,
                                         head)->perm;
-       u8 perm = *a_perm;
+       u8 perm = READ_ONCE(*a_perm);
        const u8 b_perm = container_of(b, struct tomoyo_mkdev_acl, head)
                ->perm;
 
@@ -445,7 +445,7 @@ static bool tomoyo_merge_mkdev_acl(struct tomoyo_acl_info *a,
                perm &= ~b_perm;
        else
                perm |= b_perm;
-       *a_perm = perm;
+       WRITE_ONCE(*a_perm, perm);
        return !perm;
 }
 
@@ -517,14 +517,14 @@ static bool tomoyo_merge_path2_acl(struct tomoyo_acl_info *a,
 {
        u8 * const a_perm = &container_of(a, struct tomoyo_path2_acl, head)
                ->perm;
-       u8 perm = *a_perm;
+       u8 perm = READ_ONCE(*a_perm);
        const u8 b_perm = container_of(b, struct tomoyo_path2_acl, head)->perm;
 
        if (is_delete)
                perm &= ~b_perm;
        else
                perm |= b_perm;
-       *a_perm = perm;
+       WRITE_ONCE(*a_perm, perm);
        return !perm;
 }
 
@@ -655,7 +655,7 @@ static bool tomoyo_merge_path_number_acl(struct tomoyo_acl_info *a,
 {
        u8 * const a_perm = &container_of(a, struct tomoyo_path_number_acl,
                                          head)->perm;
-       u8 perm = *a_perm;
+       u8 perm = READ_ONCE(*a_perm);
        const u8 b_perm = container_of(b, struct tomoyo_path_number_acl, head)
                ->perm;
 
@@ -663,7 +663,7 @@ static bool tomoyo_merge_path_number_acl(struct tomoyo_acl_info *a,
                perm &= ~b_perm;
        else
                perm |= b_perm;
-       *a_perm = perm;
+       WRITE_ONCE(*a_perm, perm);
        return !perm;
 }