[RFC v2 11/13] sync_file: Protect access to driver and timeline name
Tvrtko Ursulin
tvrtko.ursulin at igalia.com
Fri May 9 15:33:50 UTC 2025
Protect the access to driver and timeline name which otherwise could be
freed as dma-fence exported is signalling fences.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
---
drivers/dma-buf/sync_file.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 212df4b849fe..ad87116baa24 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -136,11 +136,13 @@ char *sync_file_get_name(struct sync_file *sync_file, char *buf, int len)
} else {
struct dma_fence *fence = sync_file->fence;
+ dma_fence_access_begin();
snprintf(buf, len, "%s-%s%llu-%lld",
dma_fence_driver_name(fence),
dma_fence_timeline_name(fence),
fence->context,
fence->seqno);
+ dma_fence_access_end();
}
return buf;
@@ -262,6 +264,8 @@ static long sync_file_ioctl_merge(struct sync_file *sync_file,
static int sync_fill_fence_info(struct dma_fence *fence,
struct sync_fence_info *info)
{
+ dma_fence_access_begin();
+
strscpy(info->obj_name, dma_fence_timeline_name(fence),
sizeof(info->obj_name));
strscpy(info->driver_name, dma_fence_driver_name(fence),
@@ -273,6 +277,8 @@ static int sync_fill_fence_info(struct dma_fence *fence,
ktime_to_ns(dma_fence_timestamp(fence)) :
ktime_set(0, 0);
+ dma_fence_access_end();
+
return info->status;
}
--
2.48.0
More information about the Intel-xe
mailing list