* [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference
@ 2024-04-11 11:40 Aleksandr Mishin
2024-04-12 20:15 ` Konrad Dybcio
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Aleksandr Mishin @ 2024-04-11 11:40 UTC (permalink / raw)
To: Christian Marangi
Cc: Aleksandr Mishin, Amit Kucheria, Thara Gopinath, Bjorn Andersson,
Konrad Dybcio, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
Lukasz Luba, linux-pm, linux-arm-msm, linux-kernel, lvc-project
compute_intercept_slope() is called from calibrate_8960() (in tsens-8960.c)
as compute_intercept_slope(priv, p1, NULL, ONE_PT_CALIB) which lead to null
pointer dereference (if DEBUG or DYNAMIC_DEBUG set).
Fix this bug by adding null pointer check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: dfc1193d4dbd ("thermal/drivers/tsens: Replace custom 8960 apis with generic apis")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
---
v2: Simplified fix
drivers/thermal/qcom/tsens.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 6d7c16ccb44d..4edee8d929a7 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -264,7 +264,7 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1,
for (i = 0; i < priv->num_sensors; i++) {
dev_dbg(priv->dev,
"%s: sensor%d - data_point1:%#x data_point2:%#x\n",
- __func__, i, p1[i], p2[i]);
+ __func__, i, p1[i], p2 ? p2[i] : 0);
if (!priv->sensor[i].slope)
priv->sensor[i].slope = SLOPE_DEFAULT;
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference
2024-04-11 11:40 [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference Aleksandr Mishin
@ 2024-04-12 20:15 ` Konrad Dybcio
2024-04-22 16:20 ` Daniel Lezcano
2024-05-14 10:18 ` [thermal: thermal/fixes] thermal/drivers/tsens: " thermal-bot for Aleksandr Mishin
2 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2024-04-12 20:15 UTC (permalink / raw)
To: Aleksandr Mishin, Christian Marangi
Cc: Amit Kucheria, Thara Gopinath, Bjorn Andersson, Rafael J. Wysocki,
Daniel Lezcano, Zhang Rui, Lukasz Luba, linux-pm, linux-arm-msm,
linux-kernel, lvc-project
On 11.04.2024 1:40 PM, Aleksandr Mishin wrote:
> compute_intercept_slope() is called from calibrate_8960() (in tsens-8960.c)
> as compute_intercept_slope(priv, p1, NULL, ONE_PT_CALIB) which lead to null
> pointer dereference (if DEBUG or DYNAMIC_DEBUG set).
> Fix this bug by adding null pointer check.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: dfc1193d4dbd ("thermal/drivers/tsens: Replace custom 8960 apis with generic apis")
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference
2024-04-11 11:40 [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference Aleksandr Mishin
2024-04-12 20:15 ` Konrad Dybcio
@ 2024-04-22 16:20 ` Daniel Lezcano
2024-05-14 10:18 ` [thermal: thermal/fixes] thermal/drivers/tsens: " thermal-bot for Aleksandr Mishin
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2024-04-22 16:20 UTC (permalink / raw)
To: Aleksandr Mishin, Christian Marangi
Cc: Amit Kucheria, Thara Gopinath, Bjorn Andersson, Konrad Dybcio,
Rafael J. Wysocki, Zhang Rui, Lukasz Luba, linux-pm,
linux-arm-msm, linux-kernel, lvc-project
On 11/04/2024 13:40, Aleksandr Mishin wrote:
> compute_intercept_slope() is called from calibrate_8960() (in tsens-8960.c)
> as compute_intercept_slope(priv, p1, NULL, ONE_PT_CALIB) which lead to null
> pointer dereference (if DEBUG or DYNAMIC_DEBUG set).
> Fix this bug by adding null pointer check.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: dfc1193d4dbd ("thermal/drivers/tsens: Replace custom 8960 apis with generic apis")
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> ---
Applied, thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [thermal: thermal/fixes] thermal/drivers/tsens: Fix null pointer dereference
2024-04-11 11:40 [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference Aleksandr Mishin
2024-04-12 20:15 ` Konrad Dybcio
2024-04-22 16:20 ` Daniel Lezcano
@ 2024-05-14 10:18 ` thermal-bot for Aleksandr Mishin
2 siblings, 0 replies; 4+ messages in thread
From: thermal-bot for Aleksandr Mishin @ 2024-05-14 10:18 UTC (permalink / raw)
To: linux-pm
Cc: Aleksandr Mishin, Konrad Dybcio, Daniel Lezcano, rui.zhang, amitk
The following commit has been merged into the thermal/fixes branch of thermal:
Commit-ID: d998ddc86a27c92140b9f7984ff41e3d1d07a48f
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//d998ddc86a27c92140b9f7984ff41e3d1d07a48f
Author: Aleksandr Mishin <amishin@t-argos.ru>
AuthorDate: Thu, 11 Apr 2024 14:40:21 +03:00
Committer: Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Tue, 23 Apr 2024 12:40:29 +02:00
thermal/drivers/tsens: Fix null pointer dereference
compute_intercept_slope() is called from calibrate_8960() (in tsens-8960.c)
as compute_intercept_slope(priv, p1, NULL, ONE_PT_CALIB) which lead to null
pointer dereference (if DEBUG or DYNAMIC_DEBUG set).
Fix this bug by adding null pointer check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: dfc1193d4dbd ("thermal/drivers/tsens: Replace custom 8960 apis with generic apis")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20240411114021.12203-1-amishin@t-argos.ru
---
drivers/thermal/qcom/tsens.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 1c9df4f..e76e230 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -265,7 +265,7 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1,
for (i = 0; i < priv->num_sensors; i++) {
dev_dbg(priv->dev,
"%s: sensor%d - data_point1:%#x data_point2:%#x\n",
- __func__, i, p1[i], p2[i]);
+ __func__, i, p1[i], p2 ? p2[i] : 0);
if (!priv->sensor[i].slope)
priv->sensor[i].slope = SLOPE_DEFAULT;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-14 10:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 11:40 [PATCH v2] drivers: thermal: tsens: Fix null pointer dereference Aleksandr Mishin
2024-04-12 20:15 ` Konrad Dybcio
2024-04-22 16:20 ` Daniel Lezcano
2024-05-14 10:18 ` [thermal: thermal/fixes] thermal/drivers/tsens: " thermal-bot for Aleksandr Mishin
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).