Signed-off-by: Ryan Lee <[email protected]>
---
 security/apparmor/lsm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 88d12e89d115..d158c5108f0e 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -167,10 +167,11 @@ static int apparmor_capget(const struct task_struct 
*target, kernel_cap_t *effec
 {
        struct aa_label *label;
        const struct cred *cred;
+       bool needput;
 
        rcu_read_lock();
        cred = __task_cred(target);
-       label = aa_get_newest_cred_label(cred);
+       label = aa_get_newest_cred_label_condref(cred, &needput);
 
        /*
         * cap_capget is stacked ahead of this and will
@@ -189,7 +190,7 @@ static int apparmor_capget(const struct task_struct 
*target, kernel_cap_t *effec
                }
        }
        rcu_read_unlock();
-       aa_put_label(label);
+       aa_put_label_condref(label, needput);
 
        return 0;
 }
-- 
2.43.0


Reply via email to