From 7e5192cbea29caf9f402b15603c2b1ee1f9b8403 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 5 Sep 2024 11:43:36 -0700 Subject: [PATCH] anv: if queue is NULL in vm_bind return early In the error handling path we end up creating a vk_sync and then later we vk_sync_wait() on it. If that wait fails somehow we'll end up calling vk_queue_set_lost(&queue->vk, ...) which would segfault if queue is NULL. If we end up in this situation (no queue), return directly whatever the backend's vm_bind function returned, propagating the error up if necessary. Fixes: dd5362c78a1 ("anv/xe: try harder when the vm_bind ioctl fails") Reviewed-by: Paulo Zanoni Part-of: (cherry picked from commit ed8d1d3c9b18172debae808820e6b6a371e7dbc3) --- .pick_status.json | 2 +- src/intel/vulkan/anv_sparse.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d64b3800518..9b66c37905d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -684,7 +684,7 @@ "description": "anv: if queue is NULL in vm_bind return early", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "dd5362c78a1d2e8bb88cd321f510e5f9660775e1", "notes": null diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c index e489c12be49..827d1fe2e0e 100644 --- a/src/intel/vulkan/anv_sparse.c +++ b/src/intel/vulkan/anv_sparse.c @@ -741,11 +741,13 @@ anv_sparse_bind_vm_bind(struct anv_device *device, { struct anv_queue *queue = submit->queue; - if (!queue) - assert(submit->wait_count == 0 && submit->signal_count == 0); - VkResult result = device->kmd_backend->vm_bind(device, submit, ANV_VM_BIND_FLAG_NONE); + if (!queue) { + assert(submit->wait_count == 0 && submit->signal_count == 0 && + submit->binds_len == 1); + return result; + } if (result == VK_ERROR_OUT_OF_HOST_MEMORY) { /* If we get this, the system is under memory pressure. First we