Skip to contentSkip to conversation

CVE-2024-35824: misc: lis3lv02d_i2c: Fix regulators getting en-/dis-abled twice on suspend/resume

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 17, 2024

lore
Share & tools
lore
#0 lore raw

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

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

misc: lis3lv02d_i2c: Fix regulators getting en-/dis-abled twice on suspend/resume

When not configured for wakeup lis3lv02d_i2c_suspend() will call lis3lv02d_poweroff() even if the device has already been turned off by the runtime-suspend handler and if configured for wakeup and the device is runtime-suspended at this point then it is not turned back on to serve as a wakeup source.

Before commit b1b9f7a49440 ("misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback"), lis3lv02d_poweroff() failed to disable the regulators which as a side effect made calling poweroff() twice ok.

Now that poweroff() correctly disables the regulators, doing this twice triggers a WARN() in the regulator core:

unbalanced disables for regulator-dummy

WARNING: CPU: 1 PID: 92 at drivers/regulator/core.c:2999 _regulator_disable

...

Fix lis3lv02d_i2c_suspend() to not call poweroff() a second time if already runtime-suspended and add a poweron() call when necessary to make wakeup work.

lis3lv02d_i2c_resume() has similar issues, with an added weirness that it always powers on the device if it is runtime suspended, after which the first runtime-resume will call poweron() again, causing the enabled count for the regulator to increase by 1 every suspend/resume. These unbalanced regulator_enable() calls cause the regulator to never be turned off and trigger the following WARN() on driver unbind:

WARNING: CPU: 1 PID: 1724 at drivers/regulator/core.c:2396 _regulator_put

Fix this by making lis3lv02d_i2c_resume() mirror the new suspend().

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

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

	Issue introduced in 6.1.77 with commit 2c1164ad927e and fixed in 6.1.84 with commit 4154e7673541
	Issue introduced in 6.6.16 with commit 1229ce1c4acd and fixed in 6.6.24 with commit 997ca4153846
	Issue introduced in 6.7.4 with commit 755182e1e866 and fixed in 6.7.12 with commit f6df761182fc

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-35824

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/misc/lis3lv02d/lis3lv02d_i2c.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/4154e767354140db7804207117e7238fb337b0e7
	https://git.kernel.org/stable/c/997ca415384612c8df76d99d9a768e0b3f42b325
	https://git.kernel.org/stable/c/f6df761182fc953907b18aba5049fc2a044ecb45
	https://git.kernel.org/stable/c/ac3e0384073b2408d6cb0d972fee9fcc3776053d