From: Christian König Date: Thu, 4 Oct 2018 12:45:17 +0000 (+0200) Subject: dma-buf: test shared slot allocation when mutex debugging is active X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=99fe21a76f0f2d36e5f9afc95ce6ed5cc354ebad;p=openwrt%2Fstaging%2Fblogic.git 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 Reviewed-by: Huang Rui Acked-by: Junwei Zhang Link: https://patchwork.kernel.org/patch/10626147/ --- diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 5ddb0e143721..2f0ffca35780 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h @@ -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); }