diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/include/policy.h | 4 | ||||
-rw-r--r-- | security/apparmor/policy.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/security/apparmor/include/policy.h b/security/apparmor/include/policy.h index f2d4b6348cbc..c28b0f20ab53 100644 --- a/security/apparmor/include/policy.h +++ b/security/apparmor/include/policy.h | |||
@@ -360,7 +360,9 @@ static inline void aa_put_replacedby(struct aa_replacedby *p) | |||
360 | static inline void __aa_update_replacedby(struct aa_profile *orig, | 360 | static inline void __aa_update_replacedby(struct aa_profile *orig, |
361 | struct aa_profile *new) | 361 | struct aa_profile *new) |
362 | { | 362 | { |
363 | struct aa_profile *tmp = rcu_dereference(orig->replacedby->profile); | 363 | struct aa_profile *tmp; |
364 | tmp = rcu_dereference_protected(orig->replacedby->profile, | ||
365 | mutex_is_locked(&orig->ns->lock)); | ||
364 | rcu_assign_pointer(orig->replacedby->profile, aa_get_profile(new)); | 366 | rcu_assign_pointer(orig->replacedby->profile, aa_get_profile(new)); |
365 | orig->flags |= PFLAG_INVALID; | 367 | orig->flags |= PFLAG_INVALID; |
366 | aa_put_profile(tmp); | 368 | aa_put_profile(tmp); |
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 6172509fa2b7..345bec07a27d 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c | |||
@@ -563,7 +563,8 @@ void __init aa_free_root_ns(void) | |||
563 | static void free_replacedby(struct aa_replacedby *r) | 563 | static void free_replacedby(struct aa_replacedby *r) |
564 | { | 564 | { |
565 | if (r) { | 565 | if (r) { |
566 | aa_put_profile(rcu_dereference(r->profile)); | 566 | /* r->profile will not be updated any more as r is dead */ |
567 | aa_put_profile(rcu_dereference_protected(r->profile, true)); | ||
567 | kzfree(r); | 568 | kzfree(r); |
568 | } | 569 | } |
569 | } | 570 | } |