msm: adsprpc: Validate the CID

Validating the CID is a valid channel number.

Change-Id: Ic11a259e8a04088f54b3df4bad982e669b02ee71
Acked-by: Abhishek Singh <abhishes@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
This commit is contained in:
Vamsi Krishna Gattupalli
2022-09-06 15:01:31 +05:30
parent 367074bf05
commit 2b533456ca

View File

@@ -1466,8 +1466,11 @@ static int context_alloc(struct fastrpc_file *fl, uint32_t kernel,
spin_lock(&fl->hlock);
hlist_add_head(&ctx->hn, &clst->pending);
cid = (fl->cid >= ADSP_DOMAIN_ID && fl->cid < NUM_CHANNELS)
? fl->cid : 0;
if (!(fl->cid >= ADSP_DOMAIN_ID && fl->cid < NUM_CHANNELS)) {
err = -ECHRNG;
goto bail;
}
cid = fl->cid;
chan = &me->channel[cid];
spin_unlock(&fl->hlock);