summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorDanila Chernetsov <listdansp@mail.ru>2023-04-04 22:05:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-27 09:44:10 +0300
commit023bd9dc410cd58e3a7357d18990a0ae377ef33f (patch)
tree32afd89173586bf81c6c5fb88f71acc17269867a /security
parentd1c946552af299f4fa85bf7da15e328123771128 (diff)
downloadlinux-023bd9dc410cd58e3a7357d18990a0ae377ef33f.tar.xz
apparmor: fix missing error check for rhashtable_insert_fast
[ Upstream commit 000518bc5aef25d3f703592a0296d578c98b1517 ] rhashtable_insert_fast() could return err value when memory allocation is failed. but unpack_profile() do not check values and this always returns success value. This patch just adds error check code. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: e025be0f26d5 ("apparmor: support querying extended trusted helper extra data") Signed-off-by: Danila Chernetsov <listdansp@mail.ru> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/policy_unpack.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 519656e68582..10896d69c442 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -909,8 +909,13 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
goto fail;
}
- rhashtable_insert_fast(profile->data, &data->head,
- profile->data->p);
+ if (rhashtable_insert_fast(profile->data, &data->head,
+ profile->data->p)) {
+ kfree_sensitive(data->key);
+ kfree_sensitive(data);
+ info = "failed to insert data to table";
+ goto fail;
+ }
}
if (!unpack_nameX(e, AA_STRUCTEND, NULL)) {