mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
apparmor: aa_getprocattr free procattr leak on format failure
[ Upstream commitfea23bf73f] aa_getprocattr() allocates the output string before rendering the label into it. If the second aa_label_snxprint() call fails, the function returned without freeing that allocation. Free and clear the output pointer on the uncommon formatting failure path before dropping the namespace reference. Fixes:76a1d263ab("apparmor: switch getprocattr to using label_print fns()") Reviewed-by: Tyler Hicks <code@thicks.com> Reviewed-by: Ryan Lee <ryan.lee@canonical.com> Signed-off-by: Zygmunt Krynicki <me@zygoon.pl> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5cba148eae
commit
58817bf37c
@@ -53,6 +53,8 @@ int aa_getprocattr(struct aa_label *label, char **string)
|
||||
FLAG_SHOW_MODE | FLAG_VIEW_SUBNS |
|
||||
FLAG_HIDDEN_UNCONFINED);
|
||||
if (len < 0) {
|
||||
kfree(*string);
|
||||
*string = NULL;
|
||||
aa_put_ns(current_ns);
|
||||
return len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user