Commit 157a92e7 authored by Dawei Li's avatar Dawei Li Committed by sanglipeng
Browse files

dma-buf: fix racing conflict of dma_heap_add()

stable inclusion
from stable-v5.10.157
commit af9de5cdcb1088b1f9b61814bfa8752f39c13b97
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7MU59

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=af9de5cdcb1088b1f9b61814bfa8752f39c13b97



--------------------------------

[ Upstream commit 432e2590 ]

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: c02a81fb ("dma-buf: Add dma-buf heaps framework")
Signed-off-by: default avatarDawei Li <set_pte_at@outlook.com>
Acked-by: default avatarAndrew Davis <afd@ti.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/TYCP286MB2323873BBDF88020781FB986CA3B9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 33feb629
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment