linux-stable/drivers/dma-buf
Guangming 679d94cd7d dma-buf: system_heap: Use 'for_each_sgtable_sg' in pages free flow
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: d963ab0f15 ("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
2021-12-01 15:30:10 +05:30
..
heaps dma-buf: system_heap: Use 'for_each_sgtable_sg' in pages free flow 2021-12-01 15:30:10 +05:30
Kconfig dma-buf: DMABUF_SYSFS_STATS should depend on DMA_SHARED_BUFFER 2021-09-07 12:42:21 +05:30
Makefile dma-buf: nuke seqno-fence 2021-08-16 14:07:17 +02:00
dma-buf-sysfs-stats.c dma-buf: Delete the DMA-BUF attachment sysfs statistics 2021-07-20 11:06:59 +02:00
dma-buf-sysfs-stats.h dma-buf: Delete the DMA-BUF attachment sysfs statistics 2021-07-20 11:06:59 +02:00
dma-buf.c drm next/fixes for 5.16-rc1 2021-11-12 12:11:07 -08:00
dma-fence-array.c dma-fence: Propagate errors to dma-fence-array container 2019-08-12 08:25:52 +01:00
dma-fence-chain.c dma-buf: some dma_fence_chain improvements 2021-06-14 19:33:16 +02:00
dma-fence.c dma-buf: clarify dma_fence_add_callback documentation 2021-09-03 10:12:12 +02:00
dma-heap.c dma-buf: dma-heap: Provide accessor to get heap name 2021-02-25 18:28:24 +05:30
dma-resv.c dma-resv: Fix dma_resv_get_fences and dma_resv_copy_fences after conversion 2021-10-11 16:14:08 +02:00
selftest.c dma-buf: Introduce selftesting framework 2019-08-19 18:01:34 +01:00
selftest.h dma-buf: Introduce selftesting framework 2019-08-19 18:01:34 +01:00
selftests.h Merge drm/drm-next into drm-intel-next-queued 2020-06-25 18:05:03 +03:00
st-dma-fence-chain.c dma-buf: add dma_fence_chain_alloc/free v3 2021-06-14 19:38:34 +02:00
st-dma-fence.c dma-buf: Avoid comma separated statements 2021-02-09 17:14:11 +01:00
sw_sync.c compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
sync_debug.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
sync_debug.h dma-buf: Remove unused sync_dump() 2019-04-23 09:30:07 +01:00
sync_file.c dma-buf/sync_file: Don't leak fences on merge failure 2021-07-12 13:34:49 +02:00
sync_trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udmabuf.c udmabuf: fix general protection fault in udmabuf_create 2021-08-12 09:27:22 +02:00