apparmor: fix reference count leak in aa_pivotroot()
stable inclusion from stable-v5.10.138 commit 2ceeb3296e9dde1d5772348046affcefdea605e2 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I60QFD Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2ceeb3296e9dde1d5772348046affcefdea605e2 -------------------------------- commit 11c3627e upstream. The aa_pivotroot() function has a reference counting bug in a specific path. When aa_replace_current_label() returns on success, the function forgets to decrement the reference count of “target”, which is increased earlier by build_pivotroot(), causing a reference leak. Fix it by decreasing the refcount of “target” in that path. Fixes: 2ea3ffb7 ("apparmor: add mount mediation") Co-developed-by:Xiyu Yang <xiyuyang19@fudan.edu.cn> Signed-off-by:
Xiyu Yang <xiyuyang19@fudan.edu.cn> Co-developed-by:
Xin Tan <tanxin.ctf@gmail.com> Signed-off-by:
Xin Tan <tanxin.ctf@gmail.com> Signed-off-by:
Xin Xiong <xiongx18@fudan.edu.cn> Signed-off-by:
John Johansen <john.johansen@canonical.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com> Reviewed-by:
Wei Li <liwei391@huawei.com>
Loading
Please sign in to comment