Skip to contentSkip to conversation

Patch "PM / clk: Fix clock error check in __pm_clk_add()" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Jul 31, 2015

Subsystems (5)
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

PM / clk: Fix clock error check in __pm_clk_add()

to the 4.1-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:
pm-clk-fix-clock-error-check-in-__pm_clk_add.patch
and it can be found in the queue-4.1 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 3fc3a0be0dab352e065d1dad7d3f81953ed0d4bc Mon Sep 17 00:00:00 2001

From: Geert Uytterhoeven <[email protected]>
Date: Fri, 8 May 2015 10:47:43 +0200
Subject: PM / clk: Fix clock error check in __pm_clk_add()

From: Geert Uytterhoeven <[email protected]>

commit 3fc3a0be0dab352e065d1dad7d3f81953ed0d4bc upstream.

In the final iteration of commit 245bd6f6af8a62a2 ("PM / clock_ops: Add pm_clk_add_clk()"), a refcount increment was added by Grygorii Strashko. However, the accompanying IS_ERR() check operates on the wrong clock pointer, which is always zero at this point, i.e. not an error. This may lead to a NULL pointer dereference later, when __clk_get() tries to dereference an error pointer.

Check the passed clock pointer instead to fix this.

Fixes 245bd6f6af8a62a2 ("PM / clock_ops: Add pm_clk_add_clk()")
---
 drivers/base/power/clock_ops.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/clock_ops.c +1 -1
@@ -93,7 +93,7 @@ static int __pm_clk_add(struct device *d
 			return -ENOMEM;
 		}
 	} else {
-		if (IS_ERR(ce->clk) || !__clk_get(clk)) {
+		if (IS_ERR(clk) || !__clk_get(clk)) {
 			kfree(ce);
 			return -ENOENT;
 		}

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

queue-4.1/pm-clk-fix-clock-error-check-in-__pm_clk_add.patch