Subject: CVE-2023-52841: media: vidtv: mux: Add check and kfree for kstrdup

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

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

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

media: vidtv: mux: Add check and kfree for kstrdup

Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.
Moreover, use kfree() in the later error handling in order to avoid
memory leak.

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

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

	Issue introduced in 5.10 with commit c2f78f0cb294 and fixed in 5.10.201 with commit 64863ba8e6b7
	Issue introduced in 5.10 with commit c2f78f0cb294 and fixed in 5.15.139 with commit 980be4c3b0d5
	Issue introduced in 5.10 with commit c2f78f0cb294 and fixed in 6.1.63 with commit a254ee1ddc59
	Issue introduced in 5.10 with commit c2f78f0cb294 and fixed in 6.5.12 with commit cb1300141199
	Issue introduced in 5.10 with commit c2f78f0cb294 and fixed in 6.6.2 with commit aae7598aff29
	Issue introduced in 5.10 with commit c2f78f0cb294 and fixed in 6.7 with commit 1fd6eb12642e

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-52841
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/media/test-drivers/vidtv/vidtv_mux.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/64863ba8e6b7651d994c6e6d506cc8aa2ac45edb
	https://git.kernel.org/stable/c/980be4c3b0d51c0f873fd750117774561c66cf68
	https://git.kernel.org/stable/c/a254ee1ddc592ae1efcce96b8c014e1bd2d5a2b4
	https://git.kernel.org/stable/c/cb13001411999adb158b39e76d94705eb2da100d
	https://git.kernel.org/stable/c/aae7598aff291d4d140be1355aa20930af948785
	https://git.kernel.org/stable/c/1fd6eb12642e0c32692924ff359c07de4b781d78