From 96ee7156af7fcabbbb3b48bced59577b9273c0df Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Fri, 13 Feb 2026 12:20:21 +0800 Subject: [PATCH] panvk: guard against NULL pointers to avoid crash Vkcts simulate_oom caselist try to alloc fail manual which caused the panvk crash. We should guard driver cannot access null pointor. Fixes: 598a8d9d11f ("panvk: Collect allocated push sets at the command level") Fixed: dEQP-VK.wsi.wayland.swapchain.simulate_oom.* Signed-off-by: Ryan Zhang Reviewed-by: Erik Faye-Lund Reviewed-by: Yiwei Zhang (cherry picked from commit 418e6c4ed980f7e33dc49731bf6aad8bf1414db3) Part-of: --- .pick_status.json | 2 +- src/panfrost/vulkan/panvk_vX_cmd_desc_state.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 98f4e62a4e4..8f2b5c70c00 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3974,7 +3974,7 @@ "description": "panvk: guard against NULL pointers to avoid crash", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "598a8d9d11f571b14376fcbf6dc1a2c69e9d8dd5", "notes": null diff --git a/src/panfrost/vulkan/panvk_vX_cmd_desc_state.c b/src/panfrost/vulkan/panvk_vX_cmd_desc_state.c index b16800c718f..25df6dbb454 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_desc_state.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_desc_state.c @@ -86,14 +86,13 @@ cmd_get_push_desc_set(struct vk_command_buffer *vk_cmdbuf, } else { push_set = vk_zalloc(&pool->vk.alloc, sizeof(*push_set), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + if (unlikely(!push_set)) { + vk_command_buffer_set_error(&cmdbuf->vk, VK_ERROR_OUT_OF_HOST_MEMORY); + return NULL; + } list_addtail(&push_set->base.node, &cmdbuf->push_sets); } - if (unlikely(!push_set)) { - vk_command_buffer_set_error(&cmdbuf->vk, VK_ERROR_OUT_OF_HOST_MEMORY); - return NULL; - } - if (desc_state->push_sets[set_idx] == NULL) { desc_state->push_sets[set_idx] = &push_set->set; push_set->set.descs.host = push_set->descs;