msm: ADSPRPC: Map and FD non-NULL check before dereferencing

When fd is zero, we set context fds to NULL. This will avoid
calling map create for context. Proper check is required
to avoid dereferencing of map and fd.

Change-Id: Id8d4b93d7d999e14ac1ebd8291137f799a73cf1a
Acked-by: Ekansh Gupta <ekangupt@qti.qualcomm.com>
Signed-off-by: Jeya R <jeyr@codeaurora.org>
Signed-off-by: Edgar Flores <edgarf@codeaurora.org>
This commit is contained in:
Edgar Flores 2020-07-28 14:06:42 -07:00 • committed by Gerrit - the friendly Code Review server
commit 7dd7c6a789

View file

@ -2210,9 +2210,10 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
PERF_END);
for (i = bufs; i < bufs + handles; ++i) {
struct fastrpc_mmap *map = ctx->maps[i];
pages[i].addr = map->phys;
pages[i].size = map->size;
if (map) {
pages[i].addr = map->phys;
pages[i].size = map->size;
}
}
fdlist = (uint64_t *)&pages[bufs + handles];
crclist = (uint32_t *)&fdlist[M_FDLIST];