Subject: CVE-2021-47158: net: dsa: sja1105: add error handling in sja1105_setup()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

net: dsa: sja1105: add error handling in sja1105_setup()

If any of sja1105_static_config_load(), sja1105_clocking_setup() or
sja1105_devlink_setup() fails, we can't just return in the middle of
sja1105_setup() or memory will leak. Add a cleanup path.

The Linux kernel CVE team has assigned CVE-2021-47158 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.2 with commit 8aa9ebccae87 and fixed in 5.10.42 with commit dd8609f20344
	Issue introduced in 5.2 with commit 8aa9ebccae87 and fixed in 5.12.9 with commit 987e4ab8b8a4
	Issue introduced in 5.2 with commit 8aa9ebccae87 and fixed in 5.13 with commit cec279a898a3

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-47158
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_main.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/dd8609f203448ca6d58ae71461208b3f6b0329b0
	https://git.kernel.org/stable/c/987e4ab8b8a4fcbf783069e03e7524cd39ffd563
	https://git.kernel.org/stable/c/cec279a898a3b004411682f212215ccaea1cd0fb