Subject: CVE-2023-52687: crypto: safexcel - Add error handling for dma_map_sg() calls

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

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

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

crypto: safexcel - Add error handling for dma_map_sg() calls

Macro dma_map_sg() may return 0 on error. This patch enables
checks in case of the macro failure and ensures unmapping of
previously mapped buffers with dma_unmap_sg().

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

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

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

	Issue introduced in 6.1 with commit 49186a7d9e46 and fixed in 6.1.75 with commit 4c0ac81a172a
	Issue introduced in 6.1 with commit 49186a7d9e46 and fixed in 6.6.14 with commit 8084b788c2fb
	Issue introduced in 6.1 with commit 49186a7d9e46 and fixed in 6.7.2 with commit fc0b785802b8
	Issue introduced in 6.1 with commit 49186a7d9e46 and fixed in 6.8 with commit 87e02063d077

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-52687
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/crypto/inside-secure/safexcel_cipher.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/4c0ac81a172a69a7733290915276672787e904ec
	https://git.kernel.org/stable/c/8084b788c2fb1260f7d44c032d5124680b20d2b2
	https://git.kernel.org/stable/c/fc0b785802b856566df3ac943e38a072557001c4
	https://git.kernel.org/stable/c/87e02063d07708cac5bfe9fd3a6a242898758ac8