asoc: msm-lsm-client: check for param size before copying

check for the proper param size before copying,
to avoid buffer overflow.

Change-Id: I3e41439fb747aeebe7677b32c768aea19fcea37c
Signed-off-by: Shimana P <quic_shimp@quicinc.com>
This commit is contained in:
Shimana P 2024-07-19 14:40:57 +05:30
commit 2bec615f5c

View file

@ -830,6 +830,13 @@ static int msm_lsm_reg_model(struct snd_pcm_substream *substream,
q6lsm_sm_set_param_data(client, p_info, &offset, sm);
if ((sm->size - offset) < p_info->param_size) {
dev_err(rtd->dev, "%s: user buff size is greater than expected\n",
__func__);
rc = -EINVAL;
goto err_copy;
}
/*
* For set_param, advance the sound model data with the
* number of bytes required by param_data.