Skip to contentSkip to conversation

Patch "regulator: core: Clear the supply pointer if enabling fails" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 30, 2017

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

regulator: core: Clear the supply pointer if enabling fails

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:
regulator-core-clear-the-supply-pointer-if-enabling-fails.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 8e5356a73604f53da6a1e0756727cb8f9f7bba17 Mon Sep 17 00:00:00 2001

From: Jon Hunter <[email protected]>
Date: Thu, 21 Apr 2016 17:11:58 +0100
Subject: regulator: core: Clear the supply pointer if enabling fails

From: Jon Hunter <[email protected]>

commit 8e5356a73604f53da6a1e0756727cb8f9f7bba17 upstream.

During the resolution of a regulator's supply, we may attempt to enable the supply if the regulator itself is already enabled. If enabling the supply fails, then we will call _regulator_put() for the supply. However, the pointer to the supply has not been cleared for the regulator and this will cause a crash if we then unregister the regulator and attempt to call regulator_put() a second time for the supply. Fix this by clearing the supply pointer if enabling the supply after fails when resolving the supply for a regulator.

---
 drivers/regulator/core.c |    1 +
 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
@@ -1519,6 +1519,7 @@ static int regulator_resolve_supply(stru
 		ret = regulator_enable(rdev->supply);
 		if (ret < 0) {
 			_regulator_put(rdev->supply);
+			rdev->supply = NULL;
 			return ret;
 		}
 	}

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

queue-4.4/regulator-core-clear-the-supply-pointer-if-enabling-fails.patch