]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
thermal/drivers/tsens: Fix null pointer dereference
authorAleksandr Mishin <amishin@t-argos.ru>
Thu, 11 Apr 2024 11:40:21 +0000 (14:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:22 +0000 (13:39 +0200)
commit27600e0c5272a262b0903e35ae1df37d33c5c1ad
tree6379d6945f33ab83a607264f9899c492e6897a59
parent89e2d5f29a36d12f3d08766c311b0021dc71dcdf
thermal/drivers/tsens: Fix null pointer dereference

[ Upstream commit d998ddc86a27c92140b9f7984ff41e3d1d07a48f ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/qcom/tsens.c