From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2950D197A75; Thu, 6 Jun 2024 14:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683236; cv=none; b=kQ7NmIT8iKYBJJZWkHmxeMBALzqbGreYBrnqmsmAPb/DuwPx4vevg1m3iDSx9G7b3zPmBg0KjOvnhO07BOixVdRE/C4W7bH884fienavTJbzhBSe729QMqQroivevp/4yNJ3vpTmoh6PMao6sN4295yJ0FHh4OehBN/RkYQ67uY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683236; c=relaxed/simple; bh=CVvrkRcmRrqlHZYFkjbpFxigbpitENuIWPm7DicCYLs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AzuJwfm0TyjHJmYHypA+oG6fZg7xefBOZdNNKLelmx5Q/QmHu2XfDVPj/tR2uJ4i0+jICkaYs436A+DhGAWoCqZiwweyT9e5FuxgwShfzGWnpG1KYKtesn69YzswbSjnAQihapcMhrwQSdSsuSK5op8TTZYfmX4iXelOSIErL2c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DTc/bpeA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DTc/bpeA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E3CC32781; Thu, 6 Jun 2024 14:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717683236; bh=CVvrkRcmRrqlHZYFkjbpFxigbpitENuIWPm7DicCYLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTc/bpeALxhu+x8W0Q/riX/AJ6J/PcECkhCVChNk2ZI0nNVcxhLo7XMrFUogWO0FC Ad472Ml8S2RcVcUU38q48ZvyaJVFQZ09E1Wzjlx3XOuArS+lfGX1kOgYek/MErRLiE qqTvCtIynSDfGLMiLmfpTiCVNGFXgesuSde+4cv0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aleksandr Mishin , Konrad Dybcio , Daniel Lezcano , Sasha Levin Subject: [PATCH 6.6 181/744] thermal/drivers/tsens: Fix null pointer dereference Date: Thu, 6 Jun 2024 15:57:33 +0200 Message-ID: <20240606131738.240578198@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240606131732.440653204@linuxfoundation.org> References: <20240606131732.440653204@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aleksandr Mishin [ 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 Reviewed-by: Konrad Dybcio Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20240411114021.12203-1-amishin@t-argos.ru Signed-off-by: Sasha Levin --- 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 98c356acfe983..ee22672471e81 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.43.0