linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: fix exynos-bus NULL pointer dereference
@ 2022-07-01 11:58 Christian Marangi
  2022-07-01 13:33 ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Marangi @ 2022-07-01 11:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Christian Marangi, linux-pm, linux-samsung-soc,
	linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski, stable

Fix exynos-bus NULL pointer dereference by correctly using the local
generated freq_table to output the debug values instead of using the
profile freq_table that is not used in the driver.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: b5d281f6c16d ("PM / devfreq: Rework freq_table to be local to devfreq struct")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/devfreq/exynos-bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index b5615e667e31..79725bbb4bb0 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -447,9 +447,9 @@ static int exynos_bus_probe(struct platform_device *pdev)
 		}
 	}
 
-	max_state = bus->devfreq->profile->max_state;
-	min_freq = (bus->devfreq->profile->freq_table[0] / 1000);
-	max_freq = (bus->devfreq->profile->freq_table[max_state - 1] / 1000);
+	max_state = bus->devfreq->max_state;
+	min_freq = (bus->devfreq->freq_table[0] / 1000);
+	max_freq = (bus->devfreq->freq_table[max_state - 1] / 1000);
 	pr_info("exynos-bus: new bus device registered: %s (%6ld KHz ~ %6ld KHz)\n",
 			dev_name(dev), min_freq, max_freq);
 
-- 
2.36.1


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

* Re: [PATCH] PM / devfreq: fix exynos-bus NULL pointer dereference
  2022-07-01 11:58 [PATCH] PM / devfreq: fix exynos-bus NULL pointer dereference Christian Marangi
@ 2022-07-01 13:33 ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2022-07-01 13:33 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Linux PM list, linux-samsung-soc, linux-arm-kernel,
	linux-kernel, Marek Szyprowski, stable

Hi Christian,

Please change the patch title as following and resend it.
- PM / devfreq: exynos-bus: Fix NULL pointer dereference

I'll ask the next version to be merged directly into linux-pm.git.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

On Fri, Jul 1, 2022 at 9:08 PM Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Fix exynos-bus NULL pointer dereference by correctly using the local
> generated freq_table to output the debug values instead of using the
> profile freq_table that is not used in the driver.
>
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Fixes: b5d281f6c16d ("PM / devfreq: Rework freq_table to be local to devfreq struct")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  drivers/devfreq/exynos-bus.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index b5615e667e31..79725bbb4bb0 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -447,9 +447,9 @@ static int exynos_bus_probe(struct platform_device *pdev)
>                 }
>         }
>
> -       max_state = bus->devfreq->profile->max_state;
> -       min_freq = (bus->devfreq->profile->freq_table[0] / 1000);
> -       max_freq = (bus->devfreq->profile->freq_table[max_state - 1] / 1000);
> +       max_state = bus->devfreq->max_state;
> +       min_freq = (bus->devfreq->freq_table[0] / 1000);
> +       max_freq = (bus->devfreq->freq_table[max_state - 1] / 1000);
>         pr_info("exynos-bus: new bus device registered: %s (%6ld KHz ~ %6ld KHz)\n",
>                         dev_name(dev), min_freq, max_freq);
>
> --
> 2.36.1
>


-- 
Best Regards,
Chanwoo Choi

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

end of thread, other threads:[~2022-07-01 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 11:58 [PATCH] PM / devfreq: fix exynos-bus NULL pointer dereference Christian Marangi
2022-07-01 13:33 ` Chanwoo Choi

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).