On 1/20/22 14:27, Christian König wrote:
It's not allowed to nest another dma_fence container into a dma_fence_array or otherwise we can run into recursion.
Warn about that when we create a dma_fence_array.
Signed-off-by: Christian König christian.koenig@amd.com Reviewed-by: Daniel Vetter daniel.vetter@ffwll.ch
drivers/dma-buf/dma-fence-array.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c index 3e07f961e2f3..4bfbcb885bbc 100644 --- a/drivers/dma-buf/dma-fence-array.c +++ b/drivers/dma-buf/dma-fence-array.c @@ -176,6 +176,19 @@ struct dma_fence_array *dma_fence_array_create(int num_fences, array->base.error = PENDING_ERROR;
- /* dma_fence_array objects should never contain any other fence
Nit: First comment line of multi-line comments shouldn't contain text.
* containers or otherwise we run into recursion and potential kernel
* stack overflow on operations on the dma_fence_array.
*
* The correct way of handling this is to flatten out the array by the
* caller instead.
*
* Enforce this here by checking that we don't create a dma_fence_array
* with any container inside.
*/
- while (seqno--)
WARN_ON(dma_fence_is_container(fences[seqno]));
s/seqno/num_fences/g ?
Thanks,
Thomas
return array; } EXPORT_SYMBOL(dma_fence_array_create);