]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: Fix memleak in aa_simple_write_to_buffer()
authorXiu Jianfeng <xiujianfeng@huawei.com>
Tue, 14 Jun 2022 09:00:01 +0000 (17:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:21 +0000 (11:18 +0200)
commit1c979690799cfd4ad35fd05b098ce22710fd2180
tree7d9446cdc25b732a6db52901d3ee7e492cd1d812
parentf527da3d610d73cc9fef1f8ece85386f685631fc
apparmor: Fix memleak in aa_simple_write_to_buffer()

commit 4921117c55fd1f54157069578da3bfe626d3baf1 upstream.

When copy_from_user failed, the memory is freed by kvfree. however the
management struct and data blob are allocated independently, so only
kvfree(data) cause a memleak issue here. Use aa_put_loaddata(data) to
fix this issue.

Fixes: 60f4d3c941f68 ("apparmor: split load data into management struct and data blob")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/apparmor/apparmorfs.c