Subject: CVE-2024-35940: pstore/zone: Add a null pointer check to the psz_kmsg_read

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

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

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

pstore/zone: Add a null pointer check to the psz_kmsg_read

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.

The Linux kernel CVE team has assigned CVE-2024-35940 to this issue.

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

	Fixed in 5.10.215 with commit 98e2b97acb87
	Fixed in 5.15.155 with commit 0ff96ec22a84
	Fixed in 6.1.86 with commit 635594cca59f
	Fixed in 6.6.27 with commit ec7256887d07
	Fixed in 6.8.6 with commit 6f9f2e498eae
	Fixed in 6.9 with commit 98bc7e26e14f

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-2024-35940
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:
	fs/pstore/zone.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/98e2b97acb875d65bdfc75fc408e67975cef3041
	https://git.kernel.org/stable/c/0ff96ec22a84d80a18d7ae8ca7eb111c34ee33bb
	https://git.kernel.org/stable/c/635594cca59f9d7a8e96187600c34facb8bc0682
	https://git.kernel.org/stable/c/ec7256887d072f98c42cdbef4dcc80ddf84c7a70
	https://git.kernel.org/stable/c/6f9f2e498eae7897ba5d3e33908917f68ff4abcc
	https://git.kernel.org/stable/c/98bc7e26e14fbb26a6abf97603d59532475e97f8