]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix reference count leak in aa_pivotroot()
authorXin Xiong <xiongx18@fudan.edu.cn>
Thu, 28 Apr 2022 03:39:08 +0000 (11:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:21 +0000 (11:18 +0200)
commit401833294fd864ecfe2067d5243e0922ad0c4d85
treedf8a0cebc79b994b08d40230374da8d6a006bb59
parenta2a501081d75234ccfefff8c565ba527f5eb7f76
apparmor: fix reference count leak in aa_pivotroot()

commit 5ee978fdbd011d71f07a9aa93eff21c6f228a41b 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: 559bef1f8ff1 ("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>
security/apparmor/mount.c