Skip to content

Commit 46619b4

Browse files
WOnder93pcmoore
authored andcommitted
selinux: fix return value on error in policydb_read()
The value of rc is still zero from the last assignment when the error path is taken. Fix it by setting it to -ENOMEM before the hashtab_create() call. Reported-by: Dan Carpenter <[email protected]> Fixes: e67b2ec ("selinux: store role transitions in a hash table") Signed-off-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 3348bd3 commit 46619b4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

security/selinux/ss/policydb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,7 @@ int policydb_read(struct policydb *p, void *fp)
25402540
goto bad;
25412541
nel = le32_to_cpu(buf[0]);
25422542

2543+
rc = -ENOMEM;
25432544
p->role_tr = hashtab_create(role_trans_hash, role_trans_cmp, nel);
25442545
if (!p->role_tr)
25452546
goto bad;

0 commit comments

Comments
 (0)