msm: adsprpc: block smmu unmap of buffer used in pending rpc call

A dynamic SMMU mapping created as part of an RPC call can potentially
be removed by a parallel munmap ioctl call before the RPC call is
complete, leading to SMMU faults.

Maintain a ref-count that indicates that the mapping is being used by
a pending RPC call and allow the mapping to be removed only if this
count is 0.

Change-Id: Ieb4ff6b298ff9c48953bc5b3539fdfe19a14b442
Acked-by: Santosh Sakore <ssakore@qti.qualcomm.com>
Signed-off-by: Santosh Sakore <quic_ssakore@quicinc.com>
This commit is contained in:
Santosh Sakore
2023-04-23 11:20:31 +05:30
committed by Gerrit - the friendly Code Review server
parent 64813776c7
commit e696574fb5
2 changed files with 48 additions and 5 deletions

View File

@@ -1031,6 +1031,8 @@ struct fastrpc_mmap {
/* Mapping for fastrpc shell */
bool is_filemap;
char *servloc_name; /* Indicate which daemon mapped this */
/* Indicates map is being used by a pending RPC call */
unsigned int ctx_refs;
};
enum fastrpc_perfkeys {