]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
PM / OPP: Call notifier without holding opp_table->lock
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 21 Sep 2017 17:44:36 +0000 (10:44 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 Sep 2017 22:44:32 +0000 (00:44 +0200)
commite4d8ae00169f7686e1da5a62e5cf797d12bf8822
tree259c6369f13b73c0e5ed857f0cd6e289f96bac7c
parente19b205be43d11bff638cad4487008c48d21c103
PM / OPP: Call notifier without holding opp_table->lock

The notifier callbacks may want to call some OPP helper routines which
may try to take the same opp_table->lock again and cause a deadlock. One
such usecase was reported by Chanwoo Choi, where calling
dev_pm_opp_disable() leads us to the devfreq's OPP notifier handler,
which further calls dev_pm_opp_find_freq_floor() and it deadlocks.

We don't really need the opp_table->lock to be held across the notifier
call though, all we want to make sure is that the 'opp' doesn't get
freed while being used from within the notifier chain. We can do it with
help of dev_pm_opp_get/put() as well. Let's do it.

Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
Fixes: 5b650b388844 "PM / OPP: Take kref from _find_opp_table()"
Reported-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp/core.c