diff mbox series

[SRU,v4,B,1/2] security/apparmor/label.c: Clean code by removing redundant instructions

Message ID 20210819132803.9481-2-georgia.garcia@canonical.com
State New
Headers show
Series Fix memory leak on profile removal | expand

Commit Message

Georgia Garcia Aug. 19, 2021, 1:28 p.m. UTC
From: Mateusz Nosek <mateusznosek0@gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1939915

Previously 'label->proxy->label' value checking
and conditional reassigning were done twice in the same function.
The second one is redundant and can be removed.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit c84b80cd41e05395655459ecc652fa5ee05c257e)
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
---
 security/apparmor/label.c | 6 ------
 1 file changed, 6 deletions(-)
diff mbox series

Patch

diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index 9171cd8ec032..c276d3035813 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -315,8 +315,6 @@  int aa_vec_unique(struct aa_profile **vec, int n, int flags)
 
 static void label_destroy(struct aa_label *label)
 {
-	struct aa_label *tmp;
-
 	AA_BUG(!label);
 
 	if (!label_isprofile(label)) {
@@ -337,10 +335,6 @@  static void label_destroy(struct aa_label *label)
 
 	aa_free_secid(label->secid);
 
-	tmp = rcu_dereference_protected(label->proxy->label, true);
-	if (tmp == label)
-		rcu_assign_pointer(label->proxy->label, NULL);
-
 	aa_put_proxy(label->proxy);
 	label->proxy = (struct aa_proxy *) PROXY_POISON + 1;
 }