Skip to contentSkip to conversation

Patch "RDMA/ucma: Fix use-after-free access in ucma_close" has been added to the 4.14-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: Fix use-after-free access in ucma_close

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:
rdma-ucma-fix-use-after-free-access-in-ucma_close.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 ed65a4dc22083e73bac599ded6a262318cad7baf Mon Sep 17 00:00:00 2001

From: Leon Romanovsky <[email protected]>
Date: Mon, 19 Mar 2018 14:20:15 +0200
Subject: RDMA/ucma: Fix use-after-free access in ucma_close

From: Leon Romanovsky <[email protected]>

commit ed65a4dc22083e73bac599ded6a262318cad7baf upstream.

The error in ucma_create_id() left ctx in the list of contexts belong to ucma file descriptor. The attempt to close this file descriptor causes to use-after-free accesses while iterating over such list.

Fixes 75216638572f ("RDMA/cma: Export rdma cm interface to userspace")
---
 drivers/infiniband/core/ucma.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/infiniband/core/ucma.c +3 -0
@@ -497,6 +497,9 @@ err1:
 	mutex_lock(&mut);
 	idr_remove(&ctx_idr, ctx->id);
 	mutex_unlock(&mut);
+	mutex_lock(&file->mut);
+	list_del(&ctx->list);
+	mutex_unlock(&file->mut);
 	kfree(ctx);
 	return ret;
 }

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

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