]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
apparmor: Fix ref count leak in task_kill
authorJohn Johansen <john.johansen@canonical.com>
Fri, 29 Dec 2023 14:54:41 +0000 (06:54 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:45:23 +0000 (15:45 -0800)
[ Upstream commit 2cb54a19ac7153b9a26a72098c495187f64c2276 ]

apparmor_task_kill was not putting the task_cred reference tc, or the
cred_label reference tc when dealing with a passed in cred, fix this
by using a single fn exit.

Fixes: 90c436a64a6e ("apparmor: pass cred through to audit info.")
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/apparmor/lsm.c

index 4981bdf0299315e24f44ca8d65b38c48bd1247c3..608a849a746810a4e68017aa9acb997aa0881f6f 100644 (file)
@@ -954,7 +954,6 @@ static int apparmor_task_kill(struct task_struct *target, struct kernel_siginfo
                cl = aa_get_newest_cred_label(cred);
                error = aa_may_signal(cred, cl, tc, tl, sig);
                aa_put_label(cl);
-               return error;
        } else {
                cl = __begin_current_label_crit_section();
                error = aa_may_signal(current_cred(), cl, tc, tl, sig);