mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 05:38:21 +07:00
drm/virtio: add fence sanity check
Make sure we don't leak half-initialized fences outside the driver. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-19-kraxel@redhat.com
This commit is contained in:
parent
6e3372508d
commit
12afce08ed
@ -41,6 +41,10 @@ bool virtio_fence_signaled(struct dma_fence *f)
|
||||
{
|
||||
struct virtio_gpu_fence *fence = to_virtio_fence(f);
|
||||
|
||||
if (WARN_ON_ONCE(fence->f.seqno == 0))
|
||||
/* leaked fence outside driver before completing
|
||||
* initialization with virtio_gpu_fence_emit */
|
||||
return false;
|
||||
if (atomic64_read(&fence->drv->last_seq) >= fence->f.seqno)
|
||||
return true;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user