Thread (11 messages) 11 messages, 7 authors, 2021-12-01

Re: [PATCH v4] dma-buf: system_heap: Use 'for_each_sgtable_sg' in pages free flow

From: John Stultz <hidden>
Date: 2021-11-29 22:34:35
Also in: dri-devel, linux-media, linux-mediatek, lkml, stable

On Thu, Nov 25, 2021 at 11:48 PM [off-list ref] wrote:
From: Guangming <redacted>

For previous version, it uses 'sg_table.nent's to traverse sg_table in pages
free flow.
However, 'sg_table.nents' is reassigned in 'dma_map_sg', it means the number of
created entries in the DMA adderess space.
So, use 'sg_table.nents' in pages free flow will case some pages can't be freed.

Here we should use sg_table.orig_nents to free pages memory, but use the
sgtable helper 'for each_sgtable_sg'(, instead of the previous rather common
helper 'for_each_sg' which maybe cause memory leak) is much better.

Fixes: d963ab0f15fb0 ("dma-buf: system_heap: Allocate higher order pages if available")
Signed-off-by: Guangming <redacted>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Cc: <redacted> # 5.11.*
Thanks so much for catching this and sending in all the revisions!

Reviewed-by: John Stultz <redacted>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help