Skip to contentSkip to conversation

Patch "IB/core: Verify that QP is security enabled in create and destroy" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 30, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

IB/core: Verify that QP is security enabled in create and destroy

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ib-core-verify-that-qp-is-security-enabled-in-create-and-destroy.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 4a50881bbac309e6f0684816a180bc3c14e1485d Mon Sep 17 00:00:00 2001

From: Moni Shoua <[email protected]>
Date: Sun, 24 Dec 2017 13:54:58 +0200
Subject: IB/core: Verify that QP is security enabled in create and destroy

From: Moni Shoua <[email protected]>

commit 4a50881bbac309e6f0684816a180bc3c14e1485d upstream.

The XRC target QP create flow sets up qp_sec only if there is an IB link with LSM security enabled. However, several other related uAPI entry points blindly follow the qp_sec NULL pointer, resulting in a possible oops.

Check for NULL before using qp_sec.

Fixes d291f1a65232 ("IB/core: Enforce PKey security on QPs")
---
 drivers/infiniband/core/security.c |    3 +++
 drivers/infiniband/core/verbs.c    |    3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/core/security.c +3 -0
@@ -386,6 +386,9 @@ int ib_open_shared_qp_security(struct ib
 	if (ret)
 		return ret;
 
+	if (!qp->qp_sec)
+		return 0;
+
 	mutex_lock(&real_qp->qp_sec->mutex);
 	ret = check_qp_port_pkey_settings(real_qp->qp_sec->ports_pkeys,
 					  qp->qp_sec);
drivers/infiniband/core/verbs.c +2 -1
@@ -1400,7 +1400,8 @@ int ib_close_qp(struct ib_qp *qp)
 	spin_unlock_irqrestore(&real_qp->device->event_handler_lock, flags);
 
 	atomic_dec(&real_qp->usecnt);
-	ib_close_shared_qp_security(qp->qp_sec);
+	if (qp->qp_sec)
+		ib_close_shared_qp_security(qp->qp_sec);
 	kfree(qp);
 
 	return 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/ib-core-verify-that-qp-is-security-enabled-in-create-and-destroy.patch queue-4.14/ib-uverbs-fix-command-checking-as-part-of-ib_uverbs_ex_modify_qp.patch