radv: initialize cmd_buffer upload list earlier

When cs allocation fails in radv_create_cmd_buffer,
radv_destroy_cmd_buffer is called before returning
VK_ERROR_OUT_OF_HOST_MEMORY. At that point, the upload list is not
initalized yet, so SIGSEGV will occur when trying to iterate through the
upload bo list. Initialize the upload list earlier to avoid this.

Signed-off-by: Benjamin Cheng <ben@bcheng.me>
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22016>
This commit is contained in:
Benjamin Cheng 2023-03-19 16:27:51 -04:00 committed by Marge Bot
parent 270f9c0b06
commit e57caf9893

View file

@ -352,6 +352,8 @@ radv_create_cmd_buffer(struct vk_command_pool *pool,
return result;
}
list_inithead(&cmd_buffer->upload.list);
cmd_buffer->device = device;
cmd_buffer->qf = vk_queue_to_radv(device->physical_device, pool->queue_family_index);
@ -373,8 +375,6 @@ radv_create_cmd_buffer(struct vk_command_pool *pool,
*cmd_buffer_out = &cmd_buffer->vk;
list_inithead(&cmd_buffer->upload.list);
return VK_SUCCESS;
}