ASoC: codecs: wcd938x: fix incorrect used of portid
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Wed, 26 Jan 2022 11:35:46 +0000 (11:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:34:10 +0000 (18:34 +0100)
commitaa7152f9f117b3e66b3c0d4158ca4c6d46ab229f
treed3bf86c7e3aa0e7978ce88027e46539347d1a795
parentbaead410e5db49e962a67fffc17ac30e44b50b7c
ASoC: codecs: wcd938x: fix incorrect used of portid

commit c5c1546a654f613e291a7c5d6f3660fc1eb6d0c7 upstream.

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.

Fixes: e8ba1e05bdc0 ("ASoC: codecs: wcd938x: add basic controls")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220126113549.8853-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/codecs/wcd938x.c