From a7c28cef64f5979281ea381ddee9374b36cc2391 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Tue, 19 Dec 2023 11:43:28 +0530 Subject: [PATCH] dsp-kernel: Check pdrcount count along with pd status Currently, only pd status is checked before sending any request to DSP. On pd down notification all the pending contexts are completed with connection reset error. But, if context gets created after the pd down callback, it is not returned with connection reset error. If the context is regarding pd attach, daemon will get attached to DSP pd. And in this scenario, if daemon gets killed and reconnection happens, ownership of init memory will be assigned back to HLOS, which will cause SMMU fault. Check pdr count for audioPD before sending any request to DSP. Change-Id: Iadf1c9ca718659086fcd6dc8db105f48337933f6 Signed-off-by: Abhishek Singh --- dsp/adsprpc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dsp/adsprpc.c b/dsp/adsprpc.c index 4f14ec6ac5..b2c9a0927d 100644 --- a/dsp/adsprpc.c +++ b/dsp/adsprpc.c @@ -6830,6 +6830,13 @@ static int fastrpc_check_pd_status(struct fastrpc_file *fl, char *sloc_name) err = fastrpc_get_spd_session(sloc_name, &session, &cid); if (err || cid != fl->cid) goto bail; + if ((!strcmp(fl->servloc_name, + AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME)) && + (me->channel[cid].spd[session].pdrcount != + me->channel[cid].spd[session].prevpdrcount)) { + err = -ECONNRESET; + goto bail; + } #if IS_ENABLED(CONFIG_QCOM_PDR_HELPERS) if (!strcmp(fl->servloc_name, AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME) || !strcmp(fl->servloc_name,