From: Greg Kroah-Hartman Date: Wed, 8 Jun 2016 00:49:01 +0000 (-0700) Subject: 4.6-stable patches X-Git-Tag: v4.4.13~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c57ccb31d49cc690179b2dd225ad37fb49e8455b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.6-stable patches added patches: regulator-fix-deadlock-during-regulator-registration.patch --- diff --git a/queue-4.6/regulator-fix-deadlock-during-regulator-registration.patch b/queue-4.6/regulator-fix-deadlock-during-regulator-registration.patch new file mode 100644 index 00000000000..da7f73b496a --- /dev/null +++ b/queue-4.6/regulator-fix-deadlock-during-regulator-registration.patch @@ -0,0 +1,67 @@ +From a2151374230820a3a6e654f2998b2a44dbfae4e1 Mon Sep 17 00:00:00 2001 +From: Jon Hunter +Date: Wed, 30 Mar 2016 17:09:13 +0100 +Subject: regulator: Fix deadlock during regulator registration + +From: Jon Hunter + +commit a2151374230820a3a6e654f2998b2a44dbfae4e1 upstream. + +Commit 5e3ca2b349b1 ("regulator: Try to resolve regulators supplies on +registration") added a call to regulator_resolve_supply() within +regulator_register() where the regulator_list_mutex is held. This causes +a deadlock to occur on the Tegra114 Dalmore board when the palmas PMIC +is registered because regulator_register_resolve_supply() calls +regulator_dev_lookup() which may try to acquire the regulator_list_mutex +again. + +Fix this by releasing the mutex before calling +regulator_register_resolve_supply() and update the error exit path to +ensure the mutex is released on an error. + +[Made commit message more legible -- broonie] + +Signed-off-by: Jon Hunter +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/regulator/core.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -3991,12 +3991,11 @@ regulator_register(const struct regulato + } + + rdev_init_debugfs(rdev); ++ mutex_unlock(®ulator_list_mutex); + + /* try to resolve regulators supply since a new one was registered */ + class_for_each_device(®ulator_class, NULL, NULL, + regulator_register_resolve_supply); +-out: +- mutex_unlock(®ulator_list_mutex); + kfree(config); + return rdev; + +@@ -4007,15 +4006,16 @@ scrub: + regulator_ena_gpio_free(rdev); + device_unregister(&rdev->dev); + /* device core frees rdev */ +- rdev = ERR_PTR(ret); + goto out; + + wash: + regulator_ena_gpio_free(rdev); + clean: + kfree(rdev); +- rdev = ERR_PTR(ret); +- goto out; ++out: ++ mutex_unlock(®ulator_list_mutex); ++ kfree(config); ++ return ERR_PTR(ret); + } + EXPORT_SYMBOL_GPL(regulator_register); + diff --git a/queue-4.6/series b/queue-4.6/series index 5f8c9a8fa96..899d5ef97d6 100644 --- a/queue-4.6/series +++ b/queue-4.6/series @@ -119,3 +119,4 @@ xfs-fix-inode-validity-check-in-xfs_iflush_cluster.patch xfs-skip-stale-inodes-in-xfs_iflush_cluster.patch drm-msm-remove-unused-variable.patch ib-hfi1-fix-hard-lockup-due-to-not-using-save-restore-spin-lock.patch +regulator-fix-deadlock-during-regulator-registration.patch