]>
Commit | Line | Data |
---|---|---|
daaa955e AM |
1 | From 8daf877473653c06a28c86bf72d63ce7e5c1d542 Mon Sep 17 00:00:00 2001 |
2 | From: John Johansen <john.johansen@canonical.com> | |
3 | Date: Wed, 16 Aug 2017 09:33:48 -0700 | |
4 | Subject: [PATCH 16/17] apparmor: fix incorrect type assignment when freeing | |
5 | proxies | |
6 | ||
7 | sparse reports | |
8 | ||
9 | poisoning the proxy->label before freeing the struct is resulting in | |
10 | a sparse build warning. | |
11 | ../security/apparmor/label.c:52:30: warning: incorrect type in assignment (different address spaces) | |
12 | ../security/apparmor/label.c:52:30: expected struct aa_label [noderef] <asn:4>*label | |
13 | ../security/apparmor/label.c:52:30: got struct aa_label *<noident> | |
14 | ||
15 | fix with RCU_INIT_POINTER as this is one of those cases where | |
16 | rcu_assign_pointer() is not needed. | |
17 | ||
18 | Signed-off-by: John Johansen <john.johansen@canonical.com> | |
19 | (cherry picked from commit 76e22e212a850bbd16cf49f9c586d4635507e0b5) | |
20 | --- | |
21 | security/apparmor/label.c | 2 +- | |
22 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
23 | ||
24 | diff --git a/security/apparmor/label.c b/security/apparmor/label.c | |
25 | index 52b4ef14840d..c5b99b954580 100644 | |
26 | --- a/security/apparmor/label.c | |
27 | +++ b/security/apparmor/label.c | |
28 | @@ -49,7 +49,7 @@ static void free_proxy(struct aa_proxy *proxy) | |
29 | /* p->label will not updated any more as p is dead */ | |
30 | aa_put_label(rcu_dereference_protected(proxy->label, true)); | |
31 | memset(proxy, 0, sizeof(*proxy)); | |
32 | - proxy->label = (struct aa_label *) PROXY_POISON; | |
33 | + RCU_INIT_POINTER(proxy->label, (struct aa_label *)PROXY_POISON); | |
34 | kfree(proxy); | |
35 | } | |
36 | } | |
37 | -- | |
38 | 2.11.0 | |
39 |