Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46977ef9 authored by Chen Zhou's avatar Chen Zhou Committed by Greg Kroah-Hartman
Browse files

selinux: Fix error return code in sel_ib_pkey_sid_slow()



commit c350f8bea271782e2733419bd2ab9bf4ec2051ef 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: 409dcf31 ("selinux: Add a cache for quicker retreival of PKey SIDs")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarChen Zhou <chenzhou10@huawei.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b0f6ea85
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -161,8 +161,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;