2022-02-22 15:47:57

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 00/16] ASoC: codecs: qcom fix validation failures

Thanks for pointing out to mixer kselftest and VALIDATION Kconfig.

This patchset addresses some of the issues in Qualcomm codecs that are
discovered with recent mixer kselftest and validations added to ASoC.

Mostly these are under
1. accessing integer value type for enum controls, which is clearly an array out of bounds access.
2. Fix incorrect ranges.
3. Fix incorrect min max for tlv controls. (I can see that other codecs also suffer same issue)
4. Fix return values for put functions.

thanks,
srini

Srinivas Kandagatla (9):
ASoC: codecs: rx-macro: fix accessing compander for aux
ASoC: codecs: rx-macro: fix accessing array out of bounds for enum
type
ASoC: codecs: tx-macro: fix accessing array out of bounds for enum
type
ASoC: codecs: va-macro: fix accessing array out of bounds for enum
type
ASoC: codecs: wsa-macro: fix accessing array out of bounds for enum
type
ASoC: codecs: wc938x: fix accessing array out of bounds for enum type
ASoC: codecs: wcd938x: fix kcontrol max values
ASoC: codecs: wcd934x: fix kcontrol max values
ASoC: codecs: wcd934x: fix return value of wcd934x_rx_hph_mode_put
ASoC: codecs: rx-macro: fix tlv min max range
ASoC: codecs: tx-macro: fix tlv min max range
ASoC: codecs: va-macro: fix tlv min max range
ASoC: codecs: wsa-macro: fix tlv min max range
ASoC: codecs: wcd938x: fix tlv min max range
ASoC: codecs: wcd9335: fix tlv min max range
ASoC: codecs: msm8916-wcd-digital: fix tlv min max range

sound/soc/codecs/lpass-rx-macro.c | 40 ++++++++-------
sound/soc/codecs/lpass-tx-macro.c | 24 ++++-----
sound/soc/codecs/lpass-va-macro.c | 12 ++---
sound/soc/codecs/lpass-wsa-macro.c | 14 +++---
sound/soc/codecs/msm8916-wcd-digital.c | 14 +++---
sound/soc/codecs/wcd9335.c | 36 ++++++-------
sound/soc/codecs/wcd934x.c | 70 +++++++++++++-------------
sound/soc/codecs/wcd938x.c | 10 ++--
8 files changed, 112 insertions(+), 108 deletions(-)

--
2.21.0


2022-02-22 16:52:57

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 08/16] ASoC: codecs: wcd934x: fix kcontrol max values

set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MAX.
set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as
max field is integer type.

Without this patch amixer for these controls will show -1 as max value to userspace.

Fixes: 9fb9b1690f0b ("ASoC: codecs: wcd934x: add mbhc support")
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/codecs/wcd934x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 6c468527fec6..f2674905a4a7 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -3023,14 +3023,14 @@ static int wcd934x_hph_impedance_get(struct snd_kcontrol *kcontrol,
return 0;
}
static const struct snd_kcontrol_new hph_type_detect_controls[] = {
- SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0,
+ SOC_SINGLE_EXT("HPH Type", 0, 0, WCD_MBHC_HPH_STEREO, 0,
wcd934x_get_hph_type, NULL),
};

static const struct snd_kcontrol_new impedance_detect_controls[] = {
- SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0,
+ SOC_SINGLE_EXT("HPHL Impedance", 0, 0, INT_MAX, 0,
wcd934x_hph_impedance_get, NULL),
- SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0,
+ SOC_SINGLE_EXT("HPHR Impedance", 0, 1, INT_MAX, 0,
wcd934x_hph_impedance_get, NULL),
};

--
2.21.0

2022-02-23 05:25:46

by Mark Brown

[permalink] [raw]
Subject: Re: (subset) [PATCH 00/16] ASoC: codecs: qcom fix validation failures

On Tue, 22 Feb 2022 11:59:17 +0000, Srinivas Kandagatla wrote:
> Thanks for pointing out to mixer kselftest and VALIDATION Kconfig.
>
> This patchset addresses some of the issues in Qualcomm codecs that are
> discovered with recent mixer kselftest and validations added to ASoC.
>
> Mostly these are under
> 1. accessing integer value type for enum controls, which is clearly an array out of bounds access.
> 2. Fix incorrect ranges.
> 3. Fix incorrect min max for tlv controls. (I can see that other codecs also suffer same issue)
> 4. Fix return values for put functions.
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-linus

Thanks!

[01/16] ASoC: codecs: rx-macro: fix accessing compander for aux
commit: 42c709c4e1ce4c136891530646c9abd5dff3524f
[02/16] ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type
commit: bcfe5f76cc4051ea3f9eb5d2c8ea621641f290a5
[04/16] ASoC: codecs: va-macro: fix accessing array out of bounds for enum type
commit: 0ea5eff7c6063a8f124188424f8e4c6727f35051
[06/16] ASoC: codecs: wc938x: fix accessing array out of bounds for enum type
commit: cc587b7c8fbbe128f6bd0dad025a0caea5e6d164
[07/16] ASoC: codecs: wcd938x: fix kcontrol max values
commit: b0217519236924f77a8382b4004e43ef8fd0dcbb
[08/16] ASoC: codecs: wcd934x: fix kcontrol max values
commit: 61163c3e7480106804269182e24db05244866493

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark