dma-buf: test shared slot allocation when mutex debugging is active

Set shared_max to the number of shared fences right before we release
the lock.

This way every attempt to add a shared fence without previously
reserving a slot will cause an error.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Junwei Zhang <Jerry.Zhang@amd.com>
Link: https://patchwork.kernel.org/patch/10626147/
This commit is contained in:
Christian König 2018-10-04 14:45:17 +02:00
Родитель ca05359f1e
Коммит 99fe21a76f
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -214,6 +214,11 @@ reservation_object_trylock(struct reservation_object *obj)
static inline void
reservation_object_unlock(struct reservation_object *obj)
{
#ifdef CONFIG_DEBUG_MUTEXES
/* Test shared fence slot reservation */
if (obj->fence)
obj->fence->shared_max = obj->fence->shared_count;
#endif
ww_mutex_unlock(&obj->lock);
}