zink: Handle null instance in 2nd create_screen
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

If zink_internal_create_screen is called twice and the first call fails
with instance==NULL, then the second call also needs to goto fail
instead of just asserting that instance is non-null.

Fixes: 015eda4a ("zink: deduplicate VkDevice and VkInstance")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13337
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35518>
This commit is contained in:
Mel Henning 2025-06-13 14:20:24 -04:00 committed by Marge Bot
parent 6d8bc4c98a
commit 7d974c32ce

View file

@ -3279,12 +3279,13 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
if (++instance_refcount == 1) {
instance_info.loader_version = zink_get_loader_version(screen);
instance = zink_create_instance(screen, &instance_info);
if (!instance) {
simple_mtx_unlock(&instance_lock);
goto fail;
}
} else {
assert(instance);
}
if (!instance) {
/* We don't decrement instance_refcount here. This prevents us from trying
* to create another instance on subsequent calls.
*/
simple_mtx_unlock(&instance_lock);
goto fail;
}
screen->instance = instance;
screen->instance_info = &instance_info;