Subject: CVE-2024-46758: hwmon: (lm95234) Fix underflows seen when writing limit attributes

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

hwmon: (lm95234) Fix underflows seen when writing limit attributes

DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

The Linux kernel CVE team has assigned CVE-2024-46758 to this issue.

Affected and fixed versions
===========================

	Fixed in 4.19.322 with commit 93f0f5721d0c
	Fixed in 5.4.284 with commit 438453dfbbdc
	Fixed in 5.10.226 with commit 59c1fb9874a0
	Fixed in 5.15.167 with commit 0fc27747633a
	Fixed in 6.1.110 with commit da765bebd90e
	Fixed in 6.6.51 with commit 46e4fd338d5b
	Fixed in 6.10.10 with commit 16f42953231b
	Fixed in 6.11 with commit af64e3e15378

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-46758
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/hwmon/lm95234.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/93f0f5721d0cca45dac50af1ae6f9a9826c699fd
	https://git.kernel.org/stable/c/438453dfbbdcf4be26891492644aa3ecbb42c336
	https://git.kernel.org/stable/c/59c1fb9874a01c9abc49a0a32f192a7e7b4e2650
	https://git.kernel.org/stable/c/0fc27747633aa419f9af40e7bdfa00d2ec94ea81
	https://git.kernel.org/stable/c/da765bebd90e1b92bdbc3c6a27a3f3cc81529ab6
	https://git.kernel.org/stable/c/46e4fd338d5bdbaf60e41cda625b24949d2af201
	https://git.kernel.org/stable/c/16f42953231be1e7be77bc24005270d9e0d9d2ee
	https://git.kernel.org/stable/c/af64e3e1537896337405f880c1e9ac1f8c0c6198