]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/amdgpu: sanitize fence numbers
authorChristian König <christian.koenig@amd.com>
Fri, 24 Jun 2016 19:11:51 +0000 (21:11 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 14 Jul 2016 20:46:03 +0000 (16:46 -0400)
Looks like the VCE block sometimes still sends nonsense
fence numbers on startup.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

index d1558768cfb73d57e30618b971a5edb5d1f1d54f..e320b5b73ac6191ec7015cce4469440befd32c9a 100644 (file)
@@ -204,16 +204,22 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
        if (seq != ring->fence_drv.sync_seq)
                amdgpu_fence_schedule_fallback(ring);
 
+       last_seq &= drv->num_fences_mask;
+       seq &= drv->num_fences_mask;
+
        while (last_seq != seq) {
                struct fence *fence, **ptr;
 
-               ptr = &drv->fences[++last_seq & drv->num_fences_mask];
+               ++last_seq;
+               last_seq &= drv->num_fences_mask;
+               ptr = &drv->fences[last_seq];
 
                /* There is always exactly one thread signaling this fence slot */
                fence = rcu_dereference_protected(*ptr, 1);
                RCU_INIT_POINTER(*ptr, NULL);
 
-               BUG_ON(!fence);
+               if (!fence)
+                       continue;
 
                r = fence_signal(fence);
                if (!r)