Subject: CVE-2023-52605: ACPI: extlog: fix NULL pointer dereference check

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

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

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

ACPI: extlog: fix NULL pointer dereference check

The gcc plugin -fanalyzer [1] tries to detect various
patterns of incorrect behaviour.  The tool reports:

drivers/acpi/acpi_extlog.c: In function ‘extlog_exit’:
drivers/acpi/acpi_extlog.c:307:12: warning: check of ‘extlog_l1_addr’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
    |
    |  306 |         ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN;
    |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    |      |                                                  |
    |      |                                                  (1) pointer ‘extlog_l1_addr’ is dereferenced here
    |  307 |         if (extlog_l1_addr)
    |      |            ~
    |      |            |
    |      |            (2) pointer ‘extlog_l1_addr’ is checked for NULL here but it was already dereferenced at (1)
    |

Fix the NULL pointer dereference check in extlog_exit().

The Linux kernel CVE team has assigned CVE-2023-52605 to this issue.

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

	Fixed in 4.19.307 with commit b7b33627be06
	Fixed in 5.4.269 with commit d2049af7ddbc
	Fixed in 5.10.210 with commit b17a71435e7e
	Fixed in 5.15.149 with commit 5457b0cbaa02
	Fixed in 6.1.77 with commit 33650372e3ea
	Fixed in 6.6.16 with commit f066171de33d
	Fixed in 6.7.4 with commit 77846571b3ba
	Fixed in 6.8 with commit 72d9b9747e78

Please see https://www.kernel.org or 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-2023-52605
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/acpi/acpi_extlog.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/b7b33627be0626b16ca321b982d6a2261ef7f703
	https://git.kernel.org/stable/c/d2049af7ddbc361702c3e1f09bd6c5e9488454ca
	https://git.kernel.org/stable/c/b17a71435e7e153e949df018244a98b4ede04069
	https://git.kernel.org/stable/c/5457b0cbaa0238fc56b855c4ef2c0b9cc9c559ab
	https://git.kernel.org/stable/c/33650372e3ead97c5ab3b84d9ad97737bc5e00c0
	https://git.kernel.org/stable/c/f066171de33d71ff0f7c46bd17636a5a26db3fb6
	https://git.kernel.org/stable/c/77846571b3ba6a6125a20ad109bb8514ba884cf9
	https://git.kernel.org/stable/c/72d9b9747e78979510e9aafdd32eb99c7aa30dd1