Commit 8c62da3b authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Zheng Zengkai
Browse files

apparmor: Fix memleak in aa_simple_write_to_buffer()

stable inclusion
from stable-v5.10.138
commit 8aab4295582eb397a125d2788b829fa62b88dbf7
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=8aab4295582eb397a125d2788b829fa62b88dbf7



--------------------------------

commit 417ea9fe 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: a6a52579 ("apparmor: split load data into management struct and data blob")
Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
parent 0ffacd6e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment