regulator: core: grab supply info before unlocking
PATCH 1/1 regulator: core: grab supply info before unlocking
It is necessary to check if there is a supply while still holding the regulator lock. Otherwise a theoretical race can occur that someone else can add a supply and then we incorrectly try to unlock that newly added regulator.
Signed-off-by John Ogness <[email protected]>
---
patch against next-20160421
drivers/regulator/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/core.c +2 -2
@@ -161,10 +161,10 @@ static void regulator_unlock_supply(struct regulator_dev *rdev)struct regulator *supply;while (1 ) { -mutex_unlock (&rdev->mutex); supply = rdev->supply; +mutex_unlock (&rdev->mutex); -if (!rdev->supply) +if (!supply)return ; rdev = supply->rdev;
Signature · 1 line
1.7.10.4
Mark Brown
maintainerQuoted 4 lines · John Ogness
It is necessary to check if there is a supply while still holding the regulator lock. Otherwise a theoretical race can occur that someone else can add a supply and then we incorrectly try to unlock that newly added regulator.
I don't understand this. What do you mean by "add a supply"?