mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
net: ipa: pass the correct size when freeing DMA memory
When the coherent memory is freed in gsi_trans_pool_exit_dma(), we
are mistakenly passing the size of a single element in the pool
rather than the actual allocated size. Fix this bug.
Fixes: 9dd441e4ed
("soc: qcom: ipa: GSI transactions")
Reported-by: Stephen Boyd <swboyd@chromium.org>
Tested-by: Sujit Kautkar <sujitka@chromium.org>
Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20201203215106.17450-1-elder@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
4eef8b1f36
commit
1130b25248
1 changed files with 6 additions and 1 deletions
|
@ -156,6 +156,9 @@ int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool,
|
|||
/* The allocator will give us a power-of-2 number of pages. But we
|
||||
* can't guarantee that, so request it. That way we won't waste any
|
||||
* memory that would be available beyond the required space.
|
||||
*
|
||||
* Note that gsi_trans_pool_exit_dma() assumes the total allocated
|
||||
* size is exactly (count * size).
|
||||
*/
|
||||
total_size = get_order(total_size) << PAGE_SHIFT;
|
||||
|
||||
|
@ -175,7 +178,9 @@ int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool,
|
|||
|
||||
void gsi_trans_pool_exit_dma(struct device *dev, struct gsi_trans_pool *pool)
|
||||
{
|
||||
dma_free_coherent(dev, pool->size, pool->base, pool->addr);
|
||||
size_t total_size = pool->count * pool->size;
|
||||
|
||||
dma_free_coherent(dev, total_size, pool->base, pool->addr);
|
||||
memset(pool, 0, sizeof(*pool));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue