]> git.itanic.dy.fi Git - linux-stable/commitdiff
selinux: fix error return code in cond_read_list()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 27 Apr 2020 12:49:35 +0000 (12:49 +0000)
committerPaul Moore <paul@paul-moore.com>
Mon, 27 Apr 2020 21:44:39 +0000 (17:44 -0400)
Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 60abd3181db2 ("selinux: convert cond_list to array")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/conditional.c

index 939a74fd8fb470e68ef6fd9172a11fd2e42679d4..da94a1b4bfda07dccee4dfeaf04b86c3440f82ce 100644 (file)
@@ -429,7 +429,7 @@ int cond_read_list(struct policydb *p, void *fp)
 
        p->cond_list = kcalloc(len, sizeof(*p->cond_list), GFP_KERNEL);
        if (!p->cond_list)
-               return rc;
+               return -ENOMEM;
 
        rc = avtab_alloc(&(p->te_cond_avtab), p->te_avtab.nel);
        if (rc)