linux-stable/drivers/dma-buf
Ville Syrjälä 05abb3be91 dma-buf/dma-resv: Stop leaking on krealloc() failure
Currently dma_resv_get_fences() will leak the previously
allocated array if the fence iteration got restarted and
the krealloc_array() fails.

Free the old array by hand, and make sure we still clear
the returned *fences so the caller won't end up accessing
freed memory. Some (but not all) of the callers of
dma_resv_get_fences() seem to still trawl through the
array even when dma_resv_get_fences() failed. And let's
zero out *num_fences as well for good measure.

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Christian König <christian.koenig@amd.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Fixes: d3c80698c9 ("dma-buf: use new iterator in dma_resv_get_fences v3")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20230713194745.1751-1-ville.syrjala@linux.intel.com
Signed-off-by: Christian König <christian.koenig@amd.com>
2023-07-15 13:57:30 +02:00
..
heaps - Nick Piggin's "shoot lazy tlbs" series, to improve the peformance of 2023-04-27 19:42:02 -07:00
Kconfig dma-buf: deprecate DMABUF_SYSFS_STATS 2022-06-23 10:51:43 +02:00
Makefile dma-buf: cleanup dma_fence_unwrap implementation 2022-05-30 14:16:32 +02:00
dma-buf-sysfs-stats.c dma-buf: make kobj_type structure constant 2023-02-17 10:59:14 +01:00
dma-buf-sysfs-stats.h dma-buf: fix dma_buf_export init order v2 2022-12-13 08:31:45 +01:00
dma-buf.c dma-buf: Include missing parentheses to documentation 2023-03-03 14:35:09 -03:00
dma-fence-array.c dma-buf/fence-array: Add fence deadline support 2023-03-25 10:55:07 -07:00
dma-fence-chain.c dma-buf/fence-chain: Add fence deadline support 2023-03-28 13:38:52 -07:00
dma-fence-unwrap.c dma-buf: keep the signaling time of merged fences v3 2023-07-03 13:47:06 +02:00
dma-fence.c dma-buf: fix an error pointer vs NULL bug 2023-07-06 19:50:23 +05:30
dma-heap.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
dma-resv.c dma-buf/dma-resv: Stop leaking on krealloc() failure 2023-07-15 13:57:30 +02:00
selftest.c
selftest.h
selftests.h dma-buf: add dma_fence_unwrap v2 2022-03-25 14:18:28 +01:00
st-dma-fence-chain.c treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
st-dma-fence-unwrap.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
st-dma-fence.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
st-dma-resv.c dma-buf: Enable signaling on fence for selftests 2022-09-16 15:53:25 +02:00
sw_sync.c dma-buf/sw_sync: Replace all non-returning strlcpy with strscpy 2023-05-24 16:32:25 +05:30
sync_debug.c
sync_debug.h
sync_file.c dma-buf/sync_file: use strscpy to replace strlcpy 2022-08-10 13:50:49 +02:00
sync_trace.h
udmabuf.c udmabuf: revert 'Add support for mapping hugepages (v4)' 2023-06-19 13:19:32 -07:00