linux-stable/drivers/dma-buf
Dawei Li af9de5cdcb dma-buf: fix racing conflict of dma_heap_add()
[ Upstream commit 432e25902b ]

Racing conflict could be:
task A                 task B
list_for_each_entry
strcmp(h->name))
                       list_for_each_entry
                       strcmp(h->name)
kzalloc                kzalloc
......                 .....
device_create          device_create
list_add
                       list_add

The root cause is that task B has no idea about the fact someone
else(A) has inserted heap with same name when it calls list_add,
so a potential collision occurs.

Fixes: c02a81fba7 ("dma-buf: Add dma-buf heaps framework")
Signed-off-by: Dawei Li <set_pte_at@outlook.com>
Acked-by: Andrew Davis <afd@ti.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/TYCP286MB2323873BBDF88020781FB986CA3B9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-02 17:40:01 +01:00
..
heaps
dma-buf.c dma-buf: WARN on dmabuf release with pending attachments 2021-11-18 14:03:52 +01:00
dma-fence-array.c dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() 2022-01-27 10:53:43 +01:00
dma-fence-chain.c
dma-fence.c
dma-heap.c dma-buf: fix racing conflict of dma_heap_add() 2022-12-02 17:40:01 +01:00
dma-resv.c
Kconfig dma-buf: DMABUF_MOVE_NOTIFY should depend on DMA_SHARED_BUFFER 2021-09-26 14:08:59 +02:00
Makefile
selftest.c
selftest.h
selftests.h
seqno-fence.c
st-dma-fence-chain.c
st-dma-fence.c
sw_sync.c
sync_debug.c
sync_debug.h
sync_file.c dma-buf/sync_file: Don't leak fences on merge failure 2021-07-25 14:36:20 +02:00
sync_trace.h
udmabuf.c udmabuf: Set ubuf->sg = NULL if the creation of sg table fails 2022-10-26 13:25:48 +02:00