Commit bc4d82fb authored by John Johansen's avatar John Johansen

apparmor: fix incorrect type assignment when freeing proxies

sparse reports

poisoning the proxy->label before freeing the struct is resulting in
a sparse build warning.
../security/apparmor/label.c:52:30: warning: incorrect type in assignment (different address spaces)
../security/apparmor/label.c:52:30:    expected struct aa_label [noderef] <asn:4>*label
../security/apparmor/label.c:52:30:    got struct aa_label *<noident>

fix with RCU_INIT_POINTER as this is one of those cases where
rcu_assign_pointer() is not needed.
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent 15372b97
...@@ -49,7 +49,7 @@ static void free_proxy(struct aa_proxy *proxy) ...@@ -49,7 +49,7 @@ static void free_proxy(struct aa_proxy *proxy)
/* p->label will not updated any more as p is dead */ /* p->label will not updated any more as p is dead */
aa_put_label(rcu_dereference_protected(proxy->label, true)); aa_put_label(rcu_dereference_protected(proxy->label, true));
memset(proxy, 0, sizeof(*proxy)); memset(proxy, 0, sizeof(*proxy));
proxy->label = (struct aa_label *) PROXY_POISON; RCU_INIT_POINTER(proxy->label, (struct aa_label *)PROXY_POISON);
kfree(proxy); kfree(proxy);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment