Subject: CVE-2021-47313: cpufreq: CPPC: Fix potential memleak in cppc_cpufreq_cpu_init

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

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

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

cpufreq: CPPC: Fix potential memleak in cppc_cpufreq_cpu_init

It's a classic example of memleak, we allocate something, we fail and
never free the resources.

Make sure we free all resources on policy ->init() failures.

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

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

	Issue introduced in 5.11 with commit a28b2bfc099c and fixed in 5.12.19 with commit b77538335575
	Issue introduced in 5.11 with commit a28b2bfc099c and fixed in 5.13.4 with commit e1b2b2b61d30
	Issue introduced in 5.11 with commit a28b2bfc099c and fixed in 5.14 with commit fe2535a44904

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-47313
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/cpufreq/cppc_cpufreq.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/b775383355755885b19d2acef977f1ca132e80a3
	https://git.kernel.org/stable/c/e1b2b2b61d30d7ce057ec17237c217d152ed97f2
	https://git.kernel.org/stable/c/fe2535a44904a77615a3af8e8fd7dafb98fb0e1b