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 2E1973DD52F for ; Fri, 24 Apr 2026 14:37:51 +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=1777041472; cv=none; b=uxveN5+4k/uYj8hdk5BksbwA7y/qxubc31LI4JnU0QHQE0Z6rsF1o9DAikH+xxerN1w3dTZmWgH6ggAdNcTPE7yxZQZnDMY2IWAXxiemCYXMWRVZTQjTm4drK00pVZtfOB7utpJgnA/Di/5eqG0jXqsSKaYpkDApX0DZqGBt77E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777041472; c=relaxed/simple; bh=xm1wqTEF+SjutQ6FRj/4u2AbwbS01IHXra/fEkJfU4k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Hewk5ZBcQ+NbswgnY34CW7AzwryIegwbUEr329DqVYXsM6Et3g+Zu5r4Sw9oe5P8PnjGMn2MZ+P4/ywm0KnTUaSOIUFsad92tpmdlD2hkVkDsNI+dFFXl9Dn/15gSnMSPmHvKcXKkx8gn3UlVuLhTCtbv2Xh6iYiO98EWVQjoZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=P0wS3RyK; 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="P0wS3RyK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E667C19425; Fri, 24 Apr 2026 14:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777041471; bh=xm1wqTEF+SjutQ6FRj/4u2AbwbS01IHXra/fEkJfU4k=; h=From:To:Cc:Subject:Date:Reply-To:From; b=P0wS3RyKjv397wllgryBrnJggSNKsIe56vLUOIz6zaNbOlEojL6wp+X0RBUsdkrXo R6imgnYN+MlaywGlgFzBIUj5AOlEX5K03v/x6Ut0tcc+VAaB6aWoMURXyB+DlekPir qCab4dp3AB6w9pGreDqmdT4WLePv0qqLImPeUuik= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-31570: can: gw: fix OOB heap access in cgw_csum_crc8_rel() Date: Fri, 24 Apr 2026 16:36:14 +0200 Message-ID: <2026042402-CVE-2026-31570-5f18@gregkh> X-Mailer: git-send-email 2.53.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4357; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=fu8UXHXPRC4pCIBiSPJxoXA+Udcn/E3S0ufgY1XQjnE=; b=owGbwMvMwCRo6H6F97bub03G02pJDJmv6y+FNskW/D1kHB9+ZfasKcuKWq74q4k43Zy789WLH es6cqoWdMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEhAMY5vsorc9ZXRc557mt Q8/USbbl/3ZMt2WY7+dUule8yPRLiVDZjl03d3Ay5rqvAwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: can: gw: fix OOB heap access in cgw_csum_crc8_rel() cgw_csum_crc8_rel() correctly computes bounds-safe indices via calc_idx(): int from = calc_idx(crc8->from_idx, cf->len); int to = calc_idx(crc8->to_idx, cf->len); int res = calc_idx(crc8->result_idx, cf->len); if (from < 0 || to < 0 || res < 0) return; However, the loop and the result write then use the raw s8 fields directly instead of the computed variables: for (i = crc8->from_idx; ...) /* BUG: raw negative index */ cf->data[crc8->result_idx] = ...; /* BUG: raw negative index */ With from_idx = to_idx = result_idx = -64 on a 64-byte CAN FD frame, calc_idx(-64, 64) = 0 so the guard passes, but the loop iterates with i = -64, reading cf->data[-64], and the write goes to cf->data[-64]. This write might end up to 56 (7.0-rc) or 40 (<= 6.19) bytes before the start of the canfd_frame on the heap. The companion function cgw_csum_xor_rel() uses `from`/`to`/`res` correctly throughout; fix cgw_csum_crc8_rel() to match. Confirmed with KASAN on linux-7.0-rc2: BUG: KASAN: slab-out-of-bounds in cgw_csum_crc8_rel+0x515/0x5b0 Read of size 1 at addr ffff8880076619c8 by task poc_cgw_oob/62 To configure the can-gw crc8 checksums CAP_NET_ADMIN is needed. The Linux kernel CVE team has assigned CVE-2026-31570 to this issue. Affected and fixed versions =========================== Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 5.10.253 with commit e7c99348b0612b2bc02d5ce6ff9873261cc7605f Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 5.15.203 with commit 999ca48d55a8a46da21519db7e834e5867200379 Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 6.1.168 with commit a025283d7f7404c739225e457fb99db2368bb544 Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 6.6.131 with commit 54ecdf76a55e75c1f5085e440f8ab671a3283ef5 Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 6.12.80 with commit c4e8eaa75fa0b6bcbfa5356d6195c4ad0e05e57a Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 6.18.21 with commit 84f8b76d24273175a22713e83e90874e1880d801 Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 6.19.11 with commit 66b689efd08227da2c5ca49b58b30a95d23c695a Issue introduced in 5.4 with commit 456a8a646b2563438c16a9b27decf9aa717f1ebb and fixed in 7.0 with commit b9c310d72783cc2f30d103eed83920a5a29c671a 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-2026-31570 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: net/can/gw.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/e7c99348b0612b2bc02d5ce6ff9873261cc7605f https://git.kernel.org/stable/c/999ca48d55a8a46da21519db7e834e5867200379 https://git.kernel.org/stable/c/a025283d7f7404c739225e457fb99db2368bb544 https://git.kernel.org/stable/c/54ecdf76a55e75c1f5085e440f8ab671a3283ef5 https://git.kernel.org/stable/c/c4e8eaa75fa0b6bcbfa5356d6195c4ad0e05e57a https://git.kernel.org/stable/c/84f8b76d24273175a22713e83e90874e1880d801 https://git.kernel.org/stable/c/66b689efd08227da2c5ca49b58b30a95d23c695a https://git.kernel.org/stable/c/b9c310d72783cc2f30d103eed83920a5a29c671a