summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2020-04-29 07:30:53 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-22 09:31:01 +0200
commitb2083327ea3ca883735470a28680d9b24ec10dba (patch)
tree4cc0242fb98ddf3e22b141039440b7626ac8d8ed
parent86dced2417b79df3517d31220430e3222d9ee8e4 (diff)
downloadlinux-stable-b2083327ea3ca883735470a28680d9b24ec10dba.tar.gz
linux-stable-b2083327ea3ca883735470a28680d9b24ec10dba.tar.bz2
linux-stable-b2083327ea3ca883735470a28680d9b24ec10dba.zip
selinux: fix error return code in policydb_read()
[ Upstream commit 4c09f8b6913a779ca0c70ea8058bf21537eebb3b ] Fix to return negative error code -ENOMEM from the kvcalloc() error handling case instead of 0, as done elsewhere in this function. Fixes: acdf52d97f82 ("selinux: convert to kvmalloc") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--security/selinux/ss/policydb.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 1260f5fb766e..dd7aabd94a92 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2496,6 +2496,7 @@ int policydb_read(struct policydb *p, void *fp)
if (rc)
goto bad;
+ rc = -ENOMEM;
p->type_attr_map_array = kvcalloc(p->p_types.nprim,
sizeof(*p->type_attr_map_array),
GFP_KERNEL);