Subject: CVE-2022-48716: ASoC: codecs: wcd938x: fix incorrect used of portid

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

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

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

ASoC: codecs: wcd938x: fix incorrect used of portid

Mixer controls have the channel id in mixer->reg, which is not same
as port id. port id should be derived from chan_info array.
So fix this. Without this, its possible that we could corrupt
struct wcd938x_sdw_priv by accessing port_map array out of range
with channel id instead of port id.

The Linux kernel CVE team has assigned CVE-2022-48716 to this issue.

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

	Issue introduced in 5.14 with commit e8ba1e05bdc0 and fixed in 5.15.22 with commit aa7152f9f117
	Issue introduced in 5.14 with commit e8ba1e05bdc0 and fixed in 5.16.8 with commit 9167f2712dc8
	Issue introduced in 5.14 with commit e8ba1e05bdc0 and fixed in 5.17 with commit c5c1546a654f

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-2022-48716
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:
	sound/soc/codecs/wcd938x.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/aa7152f9f117b3e66b3c0d4158ca4c6d46ab229f
	https://git.kernel.org/stable/c/9167f2712dc8c24964840a4d1e2ebf130e846b95
	https://git.kernel.org/stable/c/c5c1546a654f613e291a7c5d6f3660fc1eb6d0c7