CVE-2022-50040: net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions()
If an error occurs in dsa_devlink_region_create(), then 'priv->regions' array will be accessed by negative index '-1'.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
The Linux kernel CVE team has assigned CVE-2022-50040 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.10 with commit bf425b82059e0b0752c0026353c1902112200837 and fixed in 5.10.138 with commit 7983e1e44cb322eba6af84160b6d18df80603fb8 Issue introduced in 5.10 with commit bf425b82059e0b0752c0026353c1902112200837 and fixed in 5.15.63 with commit e84c6321f3578c38cb3c24258db91a92672b17a8 Issue introduced in 5.10 with commit bf425b82059e0b0752c0026353c1902112200837 and fixed in 5.19.4 with commit 79f86b862416126a2e826cb74224180d6625a32f Issue introduced in 5.10 with commit bf425b82059e0b0752c0026353c1902112200837 and fixed in 6.0 with commit fd8e899cdb5ecaf8e8ee73854a99e10807eef1de
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-50040
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/dsa/sja1105/sja1105_devlink.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/7983e1e44cb322eba6af84160b6d18df80603fb8 https://git.kernel.org/stable/c/e84c6321f3578c38cb3c24258db91a92672b17a8 https://git.kernel.org/stable/c/79f86b862416126a2e826cb74224180d6625a32f https://git.kernel.org/stable/c/fd8e899cdb5ecaf8e8ee73854a99e10807eef1de