Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1331833 > unrolled thread

[PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs

Started byJon Hunter <jonathanh@nvidia.com>
First post2016-02-11 12:30 +0100
Last post2016-02-11 22:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs Jon Hunter <jonathanh@nvidia.com> - 2016-02-11 12:30 +0100
    Re: [PATCH] PM / OPP: Fix NULL pointer dereference crash when  disabling OPPs Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-11 12:40 +0100
      Re: [PATCH] PM / OPP: Fix NULL pointer dereference crash when  disabling OPPs "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-11 22:20 +0100

#1331833 — [PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs

FromJon Hunter <jonathanh@nvidia.com>
Date2016-02-11 12:30 +0100
Subject[PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs
Message-ID<r0XBE-7Z0-15@gated-at.bofh.it>
Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by
the regulator") disables OPPs that are not supported by the regulator.
This is causes a crash on Tegra124 Jetson TK1 when using the DFLL clock
source for the CPU. The DFLL manages the voltage itself and so there is
no regulator specified for the OPPs and so we get a crash when we try to
dereference the regulator pointer. Fix this by checking to see if the
regulator IS_ERR_OR_NULL before dereferencing it.

Fixes: 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the
regulator")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/base/power/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index ab711c2c3e00..d7cd4e265766 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -975,7 +975,7 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
 {
 	struct regulator *reg = dev_opp->regulator;
 
-	if (!IS_ERR(reg) &&
+	if (!IS_ERR_OR_NULL(reg) &&
 	    !regulator_is_supported_voltage(reg, opp->u_volt_min,
 					    opp->u_volt_max)) {
 		pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n",
-- 
2.1.4

[toc] | [next] | [standalone]


#1331838 — Re: [PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs

FromViresh Kumar <viresh.kumar@linaro.org>
Date2016-02-11 12:40 +0100
SubjectRe: [PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs
Message-ID<r0XLk-83y-13@gated-at.bofh.it>
In reply to#1331833
On 11-02-16, 11:25, Jon Hunter wrote:
> Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by
> the regulator") disables OPPs that are not supported by the regulator.
> This is causes a crash on Tegra124 Jetson TK1 when using the DFLL clock
> source for the CPU. The DFLL manages the voltage itself and so there is
> no regulator specified for the OPPs and so we get a crash when we try to
> dereference the regulator pointer. Fix this by checking to see if the
> regulator IS_ERR_OR_NULL before dereferencing it.
> 
> Fixes: 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the
> regulator")
> 
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  drivers/base/power/opp/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Sorry about that :(

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

[toc] | [prev] | [next] | [standalone]


#1332371 — Re: [PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2016-02-11 22:20 +0100
SubjectRe: [PATCH] PM / OPP: Fix NULL pointer dereference crash when disabling OPPs
Message-ID<r16OC-5Vk-19@gated-at.bofh.it>
In reply to#1331838
On Thu, Feb 11, 2016 at 12:34 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 11-02-16, 11:25, Jon Hunter wrote:
>> Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by
>> the regulator") disables OPPs that are not supported by the regulator.
>> This is causes a crash on Tegra124 Jetson TK1 when using the DFLL clock
>> source for the CPU. The DFLL manages the voltage itself and so there is
>> no regulator specified for the OPPs and so we get a crash when we try to
>> dereference the regulator pointer. Fix this by checking to see if the
>> regulator IS_ERR_OR_NULL before dereferencing it.
>>
>> Fixes: 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the
>> regulator")
>>
>> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
>> ---
>>  drivers/base/power/opp/core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Sorry about that :(
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied, thanks!

Rafael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web