Subject: CVE-2021-47057: crypto: sun8i-ss - Fix memory leak of object d when dma_iv fails to map

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

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

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

crypto: sun8i-ss - Fix memory leak of object d when dma_iv fails to map

In the case where the dma_iv mapping fails, the return error path leaks
the memory allocated to object d.  Fix this by adding a new error return
label and jumping to this to ensure d is free'd before the return.

Addresses-Coverity: ("Resource leak")

The Linux kernel CVE team has assigned CVE-2021-47057 to this issue.

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

	Issue introduced in 5.10 with commit ac2614d721de and fixed in 5.10.37 with commit 617ec35ed51f
	Issue introduced in 5.10 with commit ac2614d721de and fixed in 5.11.21 with commit e1f2d739849c
	Issue introduced in 5.10 with commit ac2614d721de and fixed in 5.12.4 with commit 6516cb852d70
	Issue introduced in 5.10 with commit ac2614d721de and fixed in 5.13 with commit 98b5ef3e97b1

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-2021-47057
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/allwinner/sun8i-ss/sun8i-ss-prng.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/617ec35ed51f731a593ae7274228ef2cfc9cb781
	https://git.kernel.org/stable/c/e1f2d739849c3239df1ea3f97d40bade4b808410
	https://git.kernel.org/stable/c/6516cb852d704ff8d615de1f93cd443a99736c3d
	https://git.kernel.org/stable/c/98b5ef3e97b16eaeeedb936f8bda3594ff84a70e