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 C32A1219A74 for ; Wed, 26 Feb 2025 02:24:20 +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=1740536660; cv=none; b=gG40GTlo/Ujsy6Ewn/6TWT/3D3Mg2RwPRoQr6ktQ9CQjos6Gc1VqGdQsfWdo+vapMaMXtzNfvCbuZwmXriujKEgvL5JK6vw1fpGIDzr5JEfrhNr34Fl389jp5cisGjCXy7enJ1HsdZ7WZfCJbZfxmBCMGL3b0peNs8O3jo0KP8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536660; c=relaxed/simple; bh=gp0v6UvLPujW6r63lLtOOq+/sSnEzaBdQ51EQL1phQw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Iq+Hv98Lpsq+E5/wcR11s/hwUfOOJDSHBGdYgCpShIlZ7vNrrwDyviePhRlbWodofBKC444nPFOJnzCzM7ru6k9duBhplD03eoyVDhZ9d79OrpN8UH6YwlyBNIgsuFh5cuC9eIrD/NP8Qm4KQJayyONDS0rcxbacufyOl1OLmio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j2PDIk9o; 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="j2PDIk9o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97701C4CEDD; Wed, 26 Feb 2025 02:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536660; bh=gp0v6UvLPujW6r63lLtOOq+/sSnEzaBdQ51EQL1phQw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=j2PDIk9oFcKlWxbgHwAtkcc6oxV+vs+SQRETaHSdZXZcMUwZkaA8gqocxDwVGDchd sH/ytP9osvtDINi88OVl6vP20U9+aJWpxGgAP3+OFCQK6OT8pVWqeqSr5+KrDAdywC SCfjJxg/M2l+l0xFXm2hK5kz3ir1m/DolGYuR0pg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49612: power: supply: core: Fix boundary conditions in interpolation Date: Wed, 26 Feb 2025 03:22:55 +0100 Message-ID: <2025022613-CVE-2022-49612-8875@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2484; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=gp0v6UvLPujW6r63lLtOOq+/sSnEzaBdQ51EQL1phQw=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7qq4y74vye3125dN/bEK9CZxHar3CYr77/U5IF0yrL T30uPNCRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAExknyXDHG5Bywcvk/dzxYd1 fm530z3HefOhI8OCfbt3dL/2mJgroSvEEjgtM/1uZtMHAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: power: supply: core: Fix boundary conditions in interpolation The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simple handle boundary conditions incorrectly. The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283 ("power: supply: core: Use library interpolation"). There are two issues: First, the lines "high = i - 1" and "high = i" in ocv2cap have the wrong order compared to temp2resist. As a consequence, ocv2cap sets high=-1 if ocv>table[0].ocv, which causes an out-of-bounds read. Second, the logic of temp2resist is also not correct. Consider the case table[] = {{20, 100}, {10, 80}, {0, 60}}. For temp=5, we expect a resistance of 70% by interpolation. However, temp2resist sets high=low=2 and returns 60. The Linux kernel CVE team has assigned CVE-2022-49612 to this issue. Affected and fixed versions =========================== Issue introduced in 5.17 with commit a4585ba2050f460f749bbaf2b67bd56c41e30283 and fixed in 5.18.13 with commit a762cee5d933fe4e2e1b773d60fc74fb8248d8c4 Issue introduced in 5.17 with commit a4585ba2050f460f749bbaf2b67bd56c41e30283 and fixed in 5.19 with commit 093d27bb6f2d1963f927ef59c9a2d37059175426 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-2022-49612 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/power/supply/power_supply_core.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/a762cee5d933fe4e2e1b773d60fc74fb8248d8c4 https://git.kernel.org/stable/c/093d27bb6f2d1963f927ef59c9a2d37059175426