From bippy-a5840b7849dd Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman To: Reply-to: , Subject: CVE-2021-47586: net: stmmac: dwmac-rk: fix oob read in rk_gmac_setup Description =========== In the Linux kernel, the following vulnerability has been resolved: net: stmmac: dwmac-rk: fix oob read in rk_gmac_setup KASAN reports an out-of-bounds read in rk_gmac_setup on the line: while (ops->regs[i]) { This happens for most platforms since the regs flexible array member is empty, so the memory after the ops structure is being read here. It seems that mostly this happens to contain zero anyway, so we get lucky and everything still works. To avoid adding redundant data to nearly all the ops structures, add a new flag to indicate whether the regs field is valid and avoid this loop when it is not. The Linux kernel CVE team has assigned CVE-2021-47586 to this issue. Affected and fixed versions =========================== Issue introduced in 5.14 with commit 3bb3d6b1c195 and fixed in 5.15.11 with commit 0b4a5d1e15ce Issue introduced in 5.14 with commit 3bb3d6b1c195 and fixed in 5.16 with commit 0546b224cc77 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-47586 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/ethernet/stmicro/stmmac/dwmac-rk.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/0b4a5d1e15ce72f69be48f38dc0401dab890ae0f https://git.kernel.org/stable/c/0546b224cc7717cc8a2db076b0bb069a9c430794