diff options
author | Guangming <Guangming.Cao@mediatek.com> | 2021-11-26 10:49:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-08 11:04:42 +0300 |
commit | c1079ff6f9a082902eef86246a28de80bb33a011 (patch) | |
tree | 791ca2d0cdef9915de3521d63cced2baf9e7ad72 /arch/s390 | |
parent | 075d9c1497f2b5c4f0f4568fac2d1b82be866e3e (diff) | |
download | linux-c1079ff6f9a082902eef86246a28de80bb33a011.tar.xz |
dma-buf: system_heap: Use 'for_each_sgtable_sg' in pages free flow
commit 679d94cd7d900871e5bc9cf780bd5b73af35ab42 upstream.
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 <Guangming.Cao@mediatek.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Cc: <stable@vger.kernel.org> # 5.11.*
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211126074904.88388-1-guangming.cao@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/s390')
0 files changed, 0 insertions, 0 deletions