Subject: CVE-2023-52472: crypto: rsa - add a check for allocation failure

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

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

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

crypto: rsa - add a check for allocation failure

Static checkers insist that the mpi_alloc() allocation can fail so add
a check to prevent a NULL dereference.  Small allocations like this
can't actually fail in current kernels, but adding a check is very
simple and makes the static checkers happy.

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

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

	Issue introduced in 6.5 with commit 6637e11e4ad2 and fixed in 6.6.14 with commit 2831f4d3bfa6
	Issue introduced in 6.5 with commit 6637e11e4ad2 and fixed in 6.7.2 with commit 95ad8b6879e2
	Issue introduced in 6.5 with commit 6637e11e4ad2 and fixed in 6.8 with commit d872ca165cb6

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-2023-52472
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:
	crypto/rsa.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/2831f4d3bfa68e64c5f83e96688be779c87b3511
	https://git.kernel.org/stable/c/95ad8b6879e2e49d02e3bfc0e1fb46421633fe2a
	https://git.kernel.org/stable/c/d872ca165cb67112f2841ef9c37d51ef7e63d1e4