mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
apparmor: Fix memleak in aa_simple_write_to_buffer()
commit417ea9fe97
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:a6a52579e5
("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>
This commit is contained in:
parent
e70778fa09
commit
d552cdde73
1 changed files with 1 additions and 1 deletions
|
@ -401,7 +401,7 @@ static struct aa_loaddata *aa_simple_write_to_buffer(const char __user *userbuf,
|
|||
|
||||
data->size = copy_size;
|
||||
if (copy_from_user(data->data, userbuf, copy_size)) {
|
||||
kvfree(data);
|
||||
aa_put_loaddata(data);
|
||||
return ERR_PTR(-EFAULT);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue