CVE-2022-49275: can: m_can: m_can_tx_handler(): fix use after free of skb
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
can: m_can: m_can_tx_handler(): fix use after free of skb
can_put_echo_skb() will clone skb then free the skb. Move the can_put_echo_skb() for the m_can version 3.0.x directly before the start of the xmit in hardware, similar to the 3.1.x branch.
The Linux kernel CVE team has assigned CVE-2022-49275 to this issue.
Affected and fixed versions
===========================
Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 4.9.324 with commit d93ed9aff64968f4cdad690712eb4f48ae537bde Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 4.14.289 with commit d3892a747ab16b1eb6593a19d29f62c3b3f020ac Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 4.19.253 with commit 7728d937ec403a1ceff9483023252d2cb8777f81 Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 5.4.207 with commit 08d90846e438ac22dc56fc49ec0b0d195831c5ed Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 5.10.110 with commit 869016a2938ac44f7b2fb7fc22c89edad99eb9b3 Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 5.15.33 with commit f43e64076ff1b1dcb893fb77ad1204105f710a29 Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 5.16.19 with commit 4db7d6f481990dd179a9ee7126dc7aa31ea4fff3 Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 5.17.2 with commit 31417073493f302d26ab66b3abc098d43227b835 Issue introduced in 3.18 with commit 80646733f11c2e9de3b6339f7e635047e6087280 and fixed in 5.18 with commit 2e8e79c416aae1de224c0f1860f2e3350fa171f8
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-49275
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/net/can/m_can/m_can.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/d93ed9aff64968f4cdad690712eb4f48ae537bde https://git.kernel.org/stable/c/d3892a747ab16b1eb6593a19d29f62c3b3f020ac https://git.kernel.org/stable/c/7728d937ec403a1ceff9483023252d2cb8777f81 https://git.kernel.org/stable/c/08d90846e438ac22dc56fc49ec0b0d195831c5ed https://git.kernel.org/stable/c/869016a2938ac44f7b2fb7fc22c89edad99eb9b3 https://git.kernel.org/stable/c/f43e64076ff1b1dcb893fb77ad1204105f710a29 https://git.kernel.org/stable/c/4db7d6f481990dd179a9ee7126dc7aa31ea4fff3 https://git.kernel.org/stable/c/31417073493f302d26ab66b3abc098d43227b835 https://git.kernel.org/stable/c/2e8e79c416aae1de224c0f1860f2e3350fa171f8