Subject: CVE-2022-48879: efi: fix NULL-deref in init error path

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

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

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

efi: fix NULL-deref in init error path

In cases where runtime services are not supported or have been disabled,
the runtime services workqueue will never have been allocated.

Do not try to destroy the workqueue unconditionally in the unlikely
event that EFI initialisation fails to avoid dereferencing a NULL
pointer.

The Linux kernel CVE team has assigned CVE-2022-48879 to this issue.

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

	Issue introduced in 4.19.142 with commit 2ff3c97b4752 and fixed in 4.19.270 with commit 585a0b2b3ae7
	Issue introduced in 5.4.61 with commit 5167f194da69 and fixed in 5.4.229 with commit 5fcf75a8a4c3
	Issue introduced in 5.9 with commit 98086df8b70c and fixed in 5.10.164 with commit 4ca71bc0e199
	Issue introduced in 5.9 with commit 98086df8b70c and fixed in 5.15.89 with commit e2ea55564229
	Issue introduced in 5.9 with commit 98086df8b70c and fixed in 6.1.7 with commit adc96d30f650
	Issue introduced in 5.9 with commit 98086df8b70c and fixed in 6.2 with commit 703c13fe3c9a
	Issue introduced in 5.7.18 with commit f591a42b8f9a
	Issue introduced in 5.8.4 with commit e6584124b982

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-48879
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/efi/efi.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/585a0b2b3ae7903c6abee3087d09c69e955a7794
	https://git.kernel.org/stable/c/5fcf75a8a4c3e7ee9122d143684083c9faf20452
	https://git.kernel.org/stable/c/4ca71bc0e1995d15486cd7b60845602a28399cb5
	https://git.kernel.org/stable/c/e2ea55564229e4bea1474af15b111b3a3043b76f
	https://git.kernel.org/stable/c/adc96d30f6503d30dc68670c013716f1d9fcc747
	https://git.kernel.org/stable/c/703c13fe3c9af557d312f5895ed6a5fda2711104