From: John Johansen Date: Wed, 16 Aug 2017 16:33:48 +0000 (-0700) Subject: apparmor: fix incorrect type assignment when freeing proxies X-Git-Tag: Ubuntu-4.13.0-10.11~99 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f36c15a74dc8d02fa0f408c5fa3466acfe0deb3d;p=mirror_ubuntu-artful-kernel.git 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] *label ../security/apparmor/label.c:52:30: got struct aa_label * fix with RCU_INIT_POINTER as this is one of those cases where rcu_assign_pointer() is not needed. Signed-off-by: John Johansen (cherry picked from commit 76e22e212a850bbd16cf49f9c586d4635507e0b5 linux-next) Signed-off-by: Seth Forshee --- diff --git a/security/apparmor/label.c b/security/apparmor/label.c index 52b4ef14840d..c5b99b954580 100644 --- a/security/apparmor/label.c +++ b/security/apparmor/label.c @@ -49,7 +49,7 @@ static void free_proxy(struct aa_proxy *proxy) /* p->label will not updated any more as p is dead */ aa_put_label(rcu_dereference_protected(proxy->label, true)); memset(proxy, 0, sizeof(*proxy)); - proxy->label = (struct aa_label *) PROXY_POISON; + RCU_INIT_POINTER(proxy->label, (struct aa_label *)PROXY_POISON); kfree(proxy); } }