FROMGIT: dma-buf: insert memory barrier before updating num_fences
smp_store_mb() inserts memory barrier after storing operation. It is different with what the comment is originally aiming so Null pointer dereference can be happened if memory update is reordered. Signed-off-by: Hyejeong Choi <hjeong.choi@samsung.com> Bug: 417615398 (cherry picked from commit 72c7d62583ebce7baeb61acce6057c361f73be4a https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-fixes) Change-Id: I7a984743f929fb8120d0efcf991087e4f8d489ae Signed-off-by: Hyejeong Choi <hjeong.choi@samsung.com>
This commit is contained in:
committed by
Treehugger Robot
parent
85856ec8b2
commit
acc91ef94b
@@ -320,8 +320,9 @@ void dma_resv_add_fence(struct dma_resv *obj, struct dma_fence *fence,
|
|||||||
count++;
|
count++;
|
||||||
|
|
||||||
dma_resv_list_set(fobj, i, fence, usage);
|
dma_resv_list_set(fobj, i, fence, usage);
|
||||||
/* pointer update must be visible before we extend the num_fences */
|
/* fence update must be visible before we extend the num_fences */
|
||||||
smp_store_mb(fobj->num_fences, count);
|
smp_wmb();
|
||||||
|
fobj->num_fences = count;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dma_resv_add_fence);
|
EXPORT_SYMBOL(dma_resv_add_fence);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user