linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Fix locking of GPIO list on free
@ 2016-04-12  7:08 Mark Brown
  2016-04-13  7:03 ` Applied "regulator: core: Fix locking of GPIO list on free" to the regulator tree Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2016-04-12  7:08 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: linux-kernel, Mark Brown

When we acquire a shareable enable GPIO on probe we do so with the
regulator_list_mutex held.  However when we release the GPIOs we do this
immediately after dropping the mutex meaning that the list could become
corrupted.  Move the release into the locked region to avoid this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 85d3a746f58a..62ca85c20ff9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4066,8 +4066,8 @@ void regulator_unregister(struct regulator_dev *rdev)
 	WARN_ON(rdev->open_count);
 	unset_regulator_supplies(rdev);
 	list_del(&rdev->list);
-	mutex_unlock(&regulator_list_mutex);
 	regulator_ena_gpio_free(rdev);
+	mutex_unlock(&regulator_list_mutex);
 	device_unregister(&rdev->dev);
 }
 EXPORT_SYMBOL_GPL(regulator_unregister);
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Applied "regulator: core: Fix locking of GPIO list on free" to the regulator tree
  2016-04-12  7:08 [PATCH] regulator: core: Fix locking of GPIO list on free Mark Brown
@ 2016-04-13  7:03 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2016-04-13  7:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel

The patch

   regulator: core: Fix locking of GPIO list on free

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 2c0a303a128cbef54a7b58dc2e413b874d760097 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Tue, 12 Apr 2016 08:05:43 +0100
Subject: [PATCH] regulator: core: Fix locking of GPIO list on free

When we acquire a shareable enable GPIO on probe we do so with the
regulator_list_mutex held.  However when we release the GPIOs we do this
immediately after dropping the mutex meaning that the list could become
corrupted.  Move the release into the locked region to avoid this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1cff11205642..e414c24b2906 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4021,8 +4021,8 @@ void regulator_unregister(struct regulator_dev *rdev)
 	WARN_ON(rdev->open_count);
 	unset_regulator_supplies(rdev);
 	list_del(&rdev->list);
-	mutex_unlock(&regulator_list_mutex);
 	regulator_ena_gpio_free(rdev);
+	mutex_unlock(&regulator_list_mutex);
 	device_unregister(&rdev->dev);
 }
 EXPORT_SYMBOL_GPL(regulator_unregister);
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-13  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12  7:08 [PATCH] regulator: core: Fix locking of GPIO list on free Mark Brown
2016-04-13  7:03 ` Applied "regulator: core: Fix locking of GPIO list on free" to the regulator tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).