]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix a memleak in multi_transaction_new()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Tue, 23 Aug 2022 01:15:03 +0000 (09:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:17 +0000 (11:41 +0100)
commitdd349183b6e161b18d1ec319f12cae7a7e335ac3
tree8d58a2a112d9c6f9b2c6820845c3d269a4dbc770
parentad2f78cde877e6bd4923e127f8dbc9e14f0cc885
apparmor: fix a memleak in multi_transaction_new()

[ Upstream commit fc4b6bbf976b85b655e0bc4ed41b5ac05b4226a3 ]

In multi_transaction_new(), the variable t is not freed or passed out
on the failure of copy_from_user(t->data, buf, size), which could lead
to a memleak.

Fix this bug by adding a put_multi_transaction(t) in the error path.

Fixes: edac711257946 ("apparmor: speed up transactional queries")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/apparmor/apparmorfs.c