Module: Mesa Branch: staging/23.3 Commit: 0b95d1a0303795bf1820c3980e289d9ade58cb5a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b95d1a0303795bf1820c3980e289d9ade58cb5a
Author: José Expósito <[email protected]> Date: Wed Nov 22 12:48:47 2023 +0100 zink: initialize drm_fd to -1 The `zink_internal_create_screen()` function initializes `screen->drm_fd` to 0, a valid file descriptor value, via `rzalloc`. If an error is found during initialization, the `zink_destroy_screen()` function is invoked in the `fail` label and the `screen->drm_fd` is closed because its value is 0 and `screen->drm_fd != -1` is checked. Initialize `screen->drm_fd` to -1 to avoid this issue. Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10191 Reviewed-by: Erik Faye-Lund <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Signed-off-by: José Expósito <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26332> (cherry picked from commit fff3fc45a0125b408ca8d4dbd48e5633d63ccc5a) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_screen.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 2646874f0a8..f4af8d33215 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6694,7 +6694,7 @@ "description": "zink: initialize drm_fd to -1", "nominated": false, "nomination_type": 3, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 50168d8daa1..f42f340657b 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -3126,6 +3126,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev return NULL; } + screen->drm_fd = -1; + glsl_type_singleton_init_or_ref(); zink_debug = debug_get_option_zink_debug(); if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_AUTO)
