Subject: CVE-2020-36786: media: [next] staging: media: atomisp: fix memory leak of object flash

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

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

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

media: [next] staging: media: atomisp: fix memory leak of object flash

In the case where the call to lm3554_platform_data_func returns an
error there is a memory leak on the error return path of object
flash.  Fix this by adding an error return path that will free
flash and rename labels fail2 to fail3 and fail1 to fail2.

The Linux kernel CVE team has assigned CVE-2020-36786 to this issue.

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

	Issue introduced in 5.10 with commit 9289cdf39992 and fixed in 5.10.37 with commit cc4cc2fb5aaf
	Issue introduced in 5.10 with commit 9289cdf39992 and fixed in 5.11.21 with commit 4f0f37d03cde
	Issue introduced in 5.10 with commit 9289cdf39992 and fixed in 5.12.4 with commit 27d2eab69f7d
	Issue introduced in 5.10 with commit 9289cdf39992 and fixed in 5.13 with commit 6045b01dd0e3

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-2020-36786
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/staging/media/atomisp/i2c/atomisp-lm3554.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/cc4cc2fb5aaf9adb83c02211eb13b16cfcb7ba64
	https://git.kernel.org/stable/c/4f0f37d03cde8f4341df8454f9b40a67fda94a33
	https://git.kernel.org/stable/c/27d2eab69f7da8e94e4751ac5c6d22d809275484
	https://git.kernel.org/stable/c/6045b01dd0e3cd3759eafe7f290ed04c957500b1