Skip to content

Commit 68dae71

Browse files
Chen Zhougregkh
authored andcommitted
selinux: Fix error return code in sel_ib_pkey_sid_slow()
commit c350f8b upstream. 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: stable@vger.kernel.org Fixes: 409dcf3 ("selinux: Add a cache for quicker retreival of PKey SIDs") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 33e53f2 commit 68dae71

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎security/selinux/ibpkey.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ static int sel_ib_pkey_sid_slow(u64 subnet_prefix, u16 pkey_num, u32 *sid)
151151
* is valid, it just won't be added to the cache.
152152
*/
153153
new = kzalloc(sizeof(*new), GFP_ATOMIC);
154-
if (!new)
154+
if (!new) {
155+
ret = -ENOMEM;
155156
goto out;
157+
}
156158

157159
new->psec.subnet_prefix = subnet_prefix;
158160
new->psec.pkey = pkey_num;

0 commit comments

Comments
 (0)