Re: [PATCH] ASoC:codecs: lpass: Fix for KASAN use_after_free out of bounds

From: Mark Brown
Date: Tue May 09 2023 - 10:12:56 EST


On Tue, May 09, 2023 at 01:26:32PM +0100, Srinivas Kandagatla wrote:
> On 09/05/2023 11:32, Ravulapati Vishnu Vardhan Rao wrote:

> > val = ucontrol->value.enumerated.item[0];
> > + if (val < 0 && val > 15)
> > + return -EINVAL;

> how about

> if (val >= e->items)
> return -EINVAL;

The enum value is passed as an int so is signed unfortunately.

> We could get these checks if CONFIG_SND_CTL_INTPUT_VALIDATION was enabled.

You can't rely on that being set.

Attachment: signature.asc
Description: PGP signature