mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
ASoC: tegra: tegra210_ahub: Validate written enum value
[ Upstream commit1d8aabb413] tegra_ahub_put_value_enum() reads e->values[item[0]] before checking whether item[0] is within the enum item range. The existing check therefore happens too late to prevent an out-of-range read of the values array. Move the check before the array access. Fixes:16e1bcc2ca("ASoC: tegra: Add Tegra210 based AHUB driver") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: HyeongJun An <sammiee5311@gmail.com> Link: https://patch.msgid.link/20260609124317.38046-5-sammiee5311@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0b10c6203e
commit
4bcb23635d
@@ -60,13 +60,15 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl,
|
||||
struct soc_enum *e = (struct soc_enum *)kctl->private_value;
|
||||
struct snd_soc_dapm_update update[TEGRA_XBAR_UPDATE_MAX_REG] = { };
|
||||
unsigned int *item = uctl->value.enumerated.item;
|
||||
unsigned int value = e->values[item[0]];
|
||||
unsigned int value;
|
||||
unsigned int i, bit_pos, reg_idx = 0, reg_val = 0;
|
||||
int change = 0;
|
||||
|
||||
if (item[0] >= e->items)
|
||||
return -EINVAL;
|
||||
|
||||
value = e->values[item[0]];
|
||||
|
||||
if (value) {
|
||||
/* Get the register index and value to set */
|
||||
reg_idx = (value - 1) / (8 * cmpnt->val_bytes);
|
||||
|
||||
Reference in New Issue
Block a user