Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e449c1ad authored by Bojun Pan's avatar Bojun Pan
Browse files

msm: ipa: Decrease refcount of the pages held in cache before freeing



While freeing the buffers in the transfer ring, the ref_count of the
pages that were allocated from the sys->repl->cache have to be
decremented explicitly to ensure there is no memory leak.

Change-Id: Ie853bf15f084f503e8818d46c72671dbb9ddad7b
Acked-by: default avatarPriyadarshini Rajagopal <prajagop@qti.qualcomm.com>
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent 817c1496
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2452,13 +2452,15 @@ static void free_rx_page(void *chan_user_data, void *xfer_user_data)
	for (i = 0; i < sys->repl->capacity; i++)
		if (sys->repl->cache[i] == rx_pkt)
			break;
	if (i < sys->repl->capacity) {
		page_ref_dec(rx_pkt->page_data.page);
		sys->repl->cache[i] = NULL;
	}
	dma_unmap_page(ipa3_ctx->pdev, rx_pkt->page_data.dma_addr,
		rx_pkt->len, DMA_FROM_DEVICE);
	__free_pages(rx_pkt->page_data.page,
		IPA_WAN_PAGE_ORDER);
	kmem_cache_free(ipa3_ctx->rx_pkt_wrapper_cache, rx_pkt);
	if (i < sys->repl->capacity)
		sys->repl->cache[i] = NULL;
}

/**