Skip to contentSkip to conversation

Patch "RDMA/ucma: Check that device exists prior to accessing it" has been added to the 4.15-stable tree

PATCH [email protected] 1 participant 1 message Apr 3, 2018

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

RDMA/ucma: Check that device exists prior to accessing it

to the 4.15-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:
rdma-ucma-check-that-device-exists-prior-to-accessing-it.patch
and it can be found in the queue-4.15 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 c8d3bcbfc5eab3f01cf373d039af725f3b488813 Mon Sep 17 00:00:00 2001

From: Leon Romanovsky <[email protected]>
Date: Sun, 25 Mar 2018 11:39:05 +0300
Subject: RDMA/ucma: Check that device exists prior to accessing it

From: Leon Romanovsky <[email protected]>

commit c8d3bcbfc5eab3f01cf373d039af725f3b488813 upstream.

Ensure that device exists prior to accessing its properties.

Fixes 75216638572f ("RDMA/cma: Export rdma cm interface to userspace")
---
 drivers/infiniband/core/ucma.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/ucma.c +4 -2
@@ -1335,7 +1335,7 @@ static ssize_t ucma_notify(struct ucma_f
 {
 	struct rdma_ucm_notify cmd;
 	struct ucma_context *ctx;
-	int ret;
+	int ret = -EINVAL;
 
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
 		return -EFAULT;
@@ -1344,7 +1344,9 @@ static ssize_t ucma_notify(struct ucma_f
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
 
-	ret = rdma_notify(ctx->cm_id, (enum ib_event_type) cmd.event);
+	if (ctx->cm_id->device)
+		ret = rdma_notify(ctx->cm_id, (enum ib_event_type)cmd.event);
+
 	ucma_put_ctx(ctx);
 	return ret;
 }

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

queue-4.15/rdma-ucma-check-af-family-prior-resolving-address.patch queue-4.15/rdma-ucma-check-that-device-is-connected-prior-to-access-it.patch queue-4.15/rdma-ucma-fix-use-after-free-access-in-ucma_close.patch queue-4.15/rdma-ucma-ensure-that-cm_id-exists-prior-to-access-it.patch queue-4.15/rdma-ucma-check-that-device-exists-prior-to-accessing-it.patch