CVE-2021-47668: can: dev: can_restart: fix use after free bug
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
can: dev: can_restart: fix use after free bug
After calling netif_rx_ni(skb), dereferencing skb is unsafe. Especially, the can_frame cf which aliases skb memory is accessed after the netif_rx_ni() in:
stats->rx_bytes += cf->len;
Reordering the lines solves the issue.
The Linux kernel CVE team has assigned CVE-2021-47668 to this issue.
Affected and fixed versions
===========================
Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 4.4.254 with commit 260925a0b7d2da5449f8ecfd02c1405e0c8a45b8 Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 4.9.254 with commit bbc6847b9b8978b520f62fbc7c68c54ef0f8d282 Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 4.14.218 with commit 92668d28c7e6a7a2ba07df287669ffcdf650c421 Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 4.19.171 with commit 08ab951787098ae0b6c0364aeea7a8138226f234 Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 5.4.93 with commit ac48ef15826e83f4206c47add61072e8fc76d328 Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 5.10.11 with commit 593c072b7b3c4d7044416eb039d9ad706bedd67a Issue introduced in 2.6.31 with commit 39549eef3587f1c1e8c65c88a2400d10fd30ea17 and fixed in 5.11 with commit 03f16c5075b22c8902d2af739969e878b0879c94
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-2021-47668
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/dev.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/260925a0b7d2da5449f8ecfd02c1405e0c8a45b8 https://git.kernel.org/stable/c/bbc6847b9b8978b520f62fbc7c68c54ef0f8d282 https://git.kernel.org/stable/c/92668d28c7e6a7a2ba07df287669ffcdf650c421 https://git.kernel.org/stable/c/08ab951787098ae0b6c0364aeea7a8138226f234 https://git.kernel.org/stable/c/ac48ef15826e83f4206c47add61072e8fc76d328 https://git.kernel.org/stable/c/593c072b7b3c4d7044416eb039d9ad706bedd67a https://git.kernel.org/stable/c/03f16c5075b22c8902d2af739969e878b0879c94