Subject: CVE-2021-47609: firmware: arm_scpi: Fix string overflow in SCPI genpd driver

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

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

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

firmware: arm_scpi: Fix string overflow in SCPI genpd driver

Without the bound checks for scpi_pd->name, it could result in the buffer
overflow when copying the SCPI device name from the corresponding device
tree node as the name string is set at maximum size of 30.

Let us fix it by using devm_kasprintf so that the string buffer is
allocated dynamically.

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

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

	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 4.9.294 with commit 639901b9429a
	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 4.14.259 with commit 4694b1ec425a
	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 4.19.222 with commit 7e8645ca2c00
	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 5.4.168 with commit 802a1a850156
	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 5.10.88 with commit f0f484714f35
	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 5.15.11 with commit 976389cbb16c
	Issue introduced in 4.8 with commit 8bec4337ad40 and fixed in 5.16 with commit 865ed67ab955

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-47609
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/firmware/scpi_pm_domain.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/639901b9429a3195e0fead981ed74b51f5f31538
	https://git.kernel.org/stable/c/4694b1ec425a2d20d6f8ca3db594829fdf5f2672
	https://git.kernel.org/stable/c/7e8645ca2c0046f7cd2f0f7d569fc036c8abaedb
	https://git.kernel.org/stable/c/802a1a8501563714a5fe8824f4ed27fec04a0719
	https://git.kernel.org/stable/c/f0f484714f35d24ffa0ecb4afe3df1c5b225411d
	https://git.kernel.org/stable/c/976389cbb16cee46847e5d06250a3a0b5506781e
	https://git.kernel.org/stable/c/865ed67ab955428b9aa771d8b4f1e4fb7fd08945