Skip to contentSkip to conversation

Patch "IB/core: disallow registering 0-sized memory region" has been added to the 3.10-stable tree

PATCH [email protected] 1 participant 1 message May 2, 2015

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: disallow registering 0-sized memory region

to the 3.10-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-disallow-registering-0-sized-memory-region.patch
and it can be found in the queue-3.10 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 8abaae62f3fdead8f4ce0ab46b4ab93dee39bab2 Mon Sep 17 00:00:00 2001

From: Yann Droneaud <[email protected]>
Date: Mon, 13 Apr 2015 14:56:22 +0200
Subject: IB/core: disallow registering 0-sized memory region

From: Yann Droneaud <[email protected]>

commit 8abaae62f3fdead8f4ce0ab46b4ab93dee39bab2 upstream.

If ib_umem_get() is called with a size equal to 0 and an non-page aligned address, one page will be pinned and a 0-sized umem will be returned to the caller.

This should not be allowed: it's not expected for a memory region to have a size equal to 0.

This patch adds a check to explicitly refuse to register a 0-sized region.

---
 drivers/infiniband/core/umem.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/infiniband/core/umem.c +3 -0
@@ -94,6 +94,9 @@ struct ib_umem *ib_umem_get(struct ib_uc
 	if (dmasync)
 		dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
 
+	if (!size)
+		return ERR_PTR(-EINVAL);
+
 	/*
 	 * If the combination of the addr and size requested for this memory
 	 * region causes an integer overflow, return error.

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

queue-3.10/ib-core-don-t-disallow-registering-region-starting-at-0x0.patch queue-3.10/ib-core-disallow-registering-0-sized-memory-region.patch