Skip to contentSkip to conversation

Patch "devm_memremap: Fix error value when memremap failed" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Mar 1, 2016 Stable branch

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

devm_memremap: Fix error value when memremap failed

to the 4.4-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:
devm_memremap-fix-error-value-when-memremap-failed.patch
and it can be found in the queue-4.4 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 93f834df9c2d4e362dfdc4b05daa0a4e18814836 Mon Sep 17 00:00:00 2001

From: Toshi Kani <[email protected]>
Date: Sat, 20 Feb 2016 14:32:24 -0800
Subject: devm_memremap: Fix error value when memremap failed

From: Toshi Kani <[email protected]>

commit 93f834df9c2d4e362dfdc4b05daa0a4e18814836 upstream.

devm_memremap() returns an ERR_PTR() value in case of error. However, it returns NULL when memremap() failed. This causes the caller, such as the pmem driver, to proceed and oops later.

Change devm_memremap() to return ERR_PTR(-ENXIO) when memremap() failed.

---
 kernel/memremap.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/memremap.c +3 -1
@@ -133,8 +133,10 @@ void *devm_memremap(struct device *dev,
 	if (addr) {
 		*ptr = addr;
 		devres_add(dev, ptr);
-	} else
+	} else {
 		devres_free(ptr);
+		return ERR_PTR(-ENXIO);
+	}
 
 	return addr;
 }

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

queue-4.4/devm_memremap-fix-error-value-when-memremap-failed.patch