mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
FROMGIT: dma-buf: acquire name lock before read/write dma_buf.name
Because dma-buf.name can be freed in func: "dma_buf_set_name",
so, we need to acquire lock first before we read/write dma_buf.name
to prevent Use After Free(UAF) issue.
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/lkml/20211029021541.101157-1-guangming.cao@mediatek.com/T/
Bug: 205102180
(cherry picked from commit 8c0fd12626
https://cgit.freedesktop.org/drm/drm-misc)
Change-Id: I4ba911137ad9dae7682230245d2fa2a19f7c209f
Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
This commit is contained in:
parent
1ba7c99bd3
commit
6cf4b65244
|
|
@ -1425,6 +1425,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_unlock;
|
goto error_unlock;
|
||||||
|
|
||||||
|
spin_lock(&buf_obj->name_lock);
|
||||||
seq_printf(s, "%08zu\t%08x\t%08x\t%08ld\t%s\t%08lu\t%s\n",
|
seq_printf(s, "%08zu\t%08x\t%08x\t%08ld\t%s\t%08lu\t%s\n",
|
||||||
buf_obj->size,
|
buf_obj->size,
|
||||||
buf_obj->file->f_flags, buf_obj->file->f_mode,
|
buf_obj->file->f_flags, buf_obj->file->f_mode,
|
||||||
|
|
@ -1432,6 +1433,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
|
||||||
buf_obj->exp_name,
|
buf_obj->exp_name,
|
||||||
file_inode(buf_obj->file)->i_ino,
|
file_inode(buf_obj->file)->i_ino,
|
||||||
buf_obj->name ?: "");
|
buf_obj->name ?: "");
|
||||||
|
spin_unlock(&buf_obj->name_lock);
|
||||||
|
|
||||||
robj = buf_obj->resv;
|
robj = buf_obj->resv;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user