Skip to content

Commit

Permalink
selinux: Fix error return code in sel_ib_pkey_sid_slow()
Browse files Browse the repository at this point in the history
Fix to return a negative error code from the error handling case
instead of 0 in function sel_ib_pkey_sid_slow(), as done elsewhere
in this function.

Cc: [email protected]
Fixes: 409dcf3 ("selinux: Add a cache for quicker retreival of PKey SIDs")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Chen Zhou <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
Chen Zhou authored and pcmoore committed Nov 13, 2020
1 parent 0d50f05 commit c350f8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion security/selinux/ibpkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ static int sel_ib_pkey_sid_slow(u64 subnet_prefix, u16 pkey_num, u32 *sid)
* is valid, it just won't be added to the cache.
*/
new = kzalloc(sizeof(*new), GFP_ATOMIC);
if (!new)
if (!new) {
ret = -ENOMEM;
goto out;
}

new->psec.subnet_prefix = subnet_prefix;
new->psec.pkey = pkey_num;
Expand Down

0 comments on commit c350f8b

Please sign in to comment.