From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796418013; b=uI6b19YmoCJCVTyc/gmwSUqPv5noB+5TJ3VxuNQBcxsh8HR4CRGdACWGX6ACsQz3M3qz jxu6D6lL9hAWbaBvb/ZN3u8mlDoC5w+KlD9WhXSXMNDf8xzVSCda9ZOs2JkzwYdlkdAC8 ANtzLZiQ6DumdNFNrrF1XVamoWIBB9cO5lCWmM1ra5KsVYBBOMrR1LNWywHrQ8hla4SYK w1HBQxw5IhtX0ZXOsgSPmzr4URzwWJ5HgDTts5EblSijRf/93UmjphI70Q5+6SttziaC5 PB7L04UOhxrzeGux+5vb4VS7Qat4LjjDvAHfwQEIGAOAJb8ZmYOePXUqxOFd6EVciaA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796418013; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=8xQJrQLxLrlXgHldBKf+8nuhUOrQ7m1AW5mg9x2qjzw=; b=LtmTnZRIGf5WSCvpRVHcp/j6cB+0fSv1Y32cJ5J5qT2xu732qxgN/MT9Z/VF6fpjkewF Nli/jTG9umuNgIUI9u1Lbrb4oCMZexhdxB11i0vfx8oB/3EJRvw4gBJIj+yPC2CwJjJD/ h8sRvYCk8O0ZLs104hiHGtK66QLruiU2juvtIpXSGIc4S8m6pAMp4GsPionwUgzgO+7Z+ TsbXoi5RoKTNpOmxJf1i6OsZVvNsXsbsOcAB/tVzVKg6tu95EXnwPoI0qnPnDH0ptrTg9 1y92Txx8UybKQTNlxTaB/0xYgFASGIitQShOZqWAAXWiVRi2p2+yfHIIFVQU1CsSOcw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L15+AtOM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24E8A606A32C for ; Fri, 4 Dec 2026 21:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L15+AtOM Received: by smtp.kernel.org (Postfix) with ESMTPSA id A171F1F00936; Fri, 4 Dec 2026 21:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796418012; bh=8xQJrQLxLrlXgHldBKf+8nuhUOrQ7m1AW5mg9x2qjzw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=L15+AtOMSXLE4GpUAHO4KYVvGdBiDbe6t3KbiOpb+q3UCFsP/4MR6J8SmPlMYNksJ pFxS5ybNroRjHZoIZSNGPbf6LKsdg4EpVF7/OisyUoWBZl8zqQQrbrf2iwUfANVFdr uUb9tp2+qT0YSpLKZyYwA9FGvcass7t2350iB++4P+cxFep32R9hcowWRZ0lpEQFZV splRNRzK3DAZz7gAxvYeXEqkiBVyu7FqktdEr5bVHWu0izugzc4FPXaKQy8IUFwMlR 47fw+9oelP6h4FuNCu7lIGfaL9Ork+JMEHaY/k2z2DVjbpE86StLXQ/fzGnuMusJqW nykraXTnZnImg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] hwmon: (it87) Lock the device while reading the temperature sensor type Reply-To: sashiko-reviews@lists.linux.dev To: "Praneeth Balasubramanian" Cc: linux-hwmon@vger.kernel.org In-Reply-To: <20261204205016.1788907-1-praneethb2002@gmail.com> References: <20261204205016.1788907-1-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 21:00:12 +0000 X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > show_temp_type() calls it87_update_device() and then get_temp_type(). > it87_update_device() drops data->update_lock before it returns. Since > commit 6593eac89920 ("hwmon: (it87) Add support to detect sensor type > AMDTSI"), get_temp_type() no longer uses the cached register values but > reads IT87_REG_IFSEL, IT87_REG_TEMP_ENABLE and IT87_REG_TEMP_EXTRA from > the chip. These reads therefore run without update_lock and with SMBus > access enabled, while the comment above it87_read_value() requires both. >=20 > it87_read_value() and it87_write_value() go through one address/data > port pair. If a read of tempN_type races with a sysfs store that holds > the lock, for example set_temp_type(), the address write of one side can > land between the address and data accesses of the other. The store can > then write its value to a different register, or the read returns the > wrong register. >=20 > Take the lock with it87_lock() around get_temp_type(), as > set_temp_type() does. get_temp_type() uses none of the cached values, so > also replace it87_update_device() with dev_get_drvdata(), again as > set_temp_type() does. This avoids taking update_lock twice and an unused > refresh of the cached registers. >=20 > The missing lock was found by a static check that turns the locking rule > in a function's comment into a Clang context-analysis requirement on its > callers. >=20 > Fixes: 6593eac89920 ("hwmon: (it87) Add support to detect sensor type AMD= TSI") > Cc: stable@vger.kernel.org > Signed-off-by: Praneeth Balasubramanian Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204205016.1788= 907-1-praneethb2002@gmail.com?part=3D1