Am 10.08.2017 um 16:40 schrieb Deucher, Alexander:
-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf
Of Christian König
Sent: Thursday, August 10, 2017 9:42 AM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx
Subject: [PATCH] dma-buf: handle NULL src_list in
reservation_object_copy_fences
From: Christian König <christian.koenig@xxxxxxx>
The list of shared fences can be NULL and that needs to be handled as well.
Signed-off-by: Christian König <christian.koenig@xxxxxxx>
I'll squash this with the original patch for upstream.
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>
Please note that I haven't tested this very well. You really need a
prime setup for testing and that's not on my desk right now.
So please ping whoever reported that problem to retest.
Thanks,
Christian.
---
drivers/dma-buf/reservation.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 302c137..dec3a81 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -279,23 +279,25 @@ int reservation_object_copy_fences(struct
reservation_object *dst,
src_list = reservation_object_get_list(src);
- /*
- * resize dst->fence or allocate if it doesn't exist,
- * noop if already correct size
- */
- size = offsetof(typeof(*src_list), shared[src_list->shared_count]);
- dst_list = kmalloc(size, GFP_KERNEL);
- if (!dst_list)
- return -ENOMEM;
+ if (src_list) {
+ size = offsetof(typeof(*src_list),
+ shared[src_list->shared_count]);
+ dst_list = kmalloc(size, GFP_KERNEL);
+ if (!dst_list)
+ return -ENOMEM;
+
+ dst_list->shared_count = src_list->shared_count;
+ dst_list->shared_max = src_list->shared_count;
+ for (i = 0; i < src_list->shared_count; ++i)
+ dst_list->shared[i] =
+ dma_fence_get(src_list->shared[i]);
+ } else {
+ dst_list = NULL;
+ }
kfree(dst->staged);
dst->staged = NULL;
- dst_list->shared_count = src_list->shared_count;
- dst_list->shared_max = src_list->shared_count;
- for (i = 0; i < src_list->shared_count; ++i)
- dst_list->shared[i] = dma_fence_get(src_list->shared[i]);
-
src_list = reservation_object_get_list(dst);
old = reservation_object_get_excl(dst);
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel