From e211a7c6eebb9f52977832115cd294bcebc3514f Mon Sep 17 00:00:00 2001 From: Vamsi krishna Gattupalli Date: Thu, 4 Mar 2021 12:19:46 +0530 Subject: [PATCH] msm: adsprpc: Clean DMA handles maps in case of error Free DMA handle fd maps in case of error while creating map for other handles. Change-Id: Iae062bc958a58f38e4424fab88b451813478ae97 Acked-by: Deepika Singh Signed-off-by: Vamsi krishna Gattupalli --- drivers/char/adsprpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 179be6df613a..f18d59dc0732 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -2233,7 +2233,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) size_t rlen = 0, copylen = 0, metalen = 0, lrpralen = 0; size_t totallen = 0; //header and non ion copy buf len int i, oix; - int err = 0; + int err = 0, j = 0; int mflags = 0; uint64_t *fdlist = NULL; uint32_t *crclist = NULL; @@ -2278,6 +2278,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) FASTRPC_ATTR_NOVA, 0, 0, dmaflags, &ctx->maps[i]); if (err) { + for (j = bufs; j < i; j++) + fastrpc_mmap_free(ctx->maps[j], 0); mutex_unlock(&ctx->fl->map_mutex); goto bail; }