* [PATCH v2] backlight: pm8941: Add NULL check in exynos_generic_icc_probe()
@ 2025-04-01 10:45 Henry Martin
2025-04-01 11:00 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Henry Martin @ 2025-04-01 10:45 UTC (permalink / raw)
To: georgi.djakov, krzk
Cc: s.nawrocki, a.swigon, alim.akhtar, linux-pm, linux-samsung-soc,
linux-arm-kernel, linux-kernel, Henry Martin
devm_kasprintf() returns NULL when memory allocation fails. Currently,
exynos_generic_icc_probe() does not check for this case, which results
in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
Fixes: 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
V1 -> V2: The fix ensures icc_node cleanup on devm_kasprintf() failure
without restructuring the proven error handling workflow.
drivers/interconnect/samsung/exynos.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/interconnect/samsung/exynos.c b/drivers/interconnect/samsung/exynos.c
index 9e041365d909..57e779b3e942 100644
--- a/drivers/interconnect/samsung/exynos.c
+++ b/drivers/interconnect/samsung/exynos.c
@@ -134,6 +134,10 @@ static int exynos_generic_icc_probe(struct platform_device *pdev)
priv->node = icc_node;
icc_node->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
bus_dev->of_node);
+ if (!icc_node->name) {
+ ret = -ENOMEM;
+ goto err_node_del;
+ }
if (of_property_read_u32(bus_dev->of_node, "samsung,data-clock-ratio",
&priv->bus_clk_ratio))
priv->bus_clk_ratio = EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] backlight: pm8941: Add NULL check in exynos_generic_icc_probe()
2025-04-01 10:45 [PATCH v2] backlight: pm8941: Add NULL check in exynos_generic_icc_probe() Henry Martin
@ 2025-04-01 11:00 ` Krzysztof Kozlowski
2025-04-24 3:03 ` henry martin
0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-01 11:00 UTC (permalink / raw)
To: Henry Martin, georgi.djakov
Cc: s.nawrocki, a.swigon, alim.akhtar, linux-pm, linux-samsung-soc,
linux-arm-kernel, linux-kernel
On 01/04/2025 12:45, Henry Martin wrote:
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> exynos_generic_icc_probe() does not check for this case, which results
> in a NULL pointer dereference.
>
> Add NULL check after devm_kasprintf() to prevent this issue.
>
> Fixes: 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> ---
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] backlight: pm8941: Add NULL check in exynos_generic_icc_probe()
2025-04-01 11:00 ` Krzysztof Kozlowski
@ 2025-04-24 3:03 ` henry martin
0 siblings, 0 replies; 3+ messages in thread
From: henry martin @ 2025-04-24 3:03 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: georgi.djakov, s.nawrocki, a.swigon, alim.akhtar, linux-pm,
linux-samsung-soc, linux-arm-kernel, linux-kernel
Hi Krzysztof,
Just a friendly reminder about the patch below which received your Reviewed-by
tag but hasn't been applied yet. Could you let me know if there are any further
actions needed?
Krzysztof Kozlowski <krzk@kernel.org> 于2025年4月1日周二 19:00写道:
>
> On 01/04/2025 12:45, Henry Martin wrote:
> > devm_kasprintf() returns NULL when memory allocation fails. Currently,
> > exynos_generic_icc_probe() does not check for this case, which results
> > in a NULL pointer dereference.
> >
> > Add NULL check after devm_kasprintf() to prevent this issue.
> >
> > Fixes: 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs")
> > Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> > ---
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-24 3:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 10:45 [PATCH v2] backlight: pm8941: Add NULL check in exynos_generic_icc_probe() Henry Martin
2025-04-01 11:00 ` Krzysztof Kozlowski
2025-04-24 3:03 ` henry martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox