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: 598a8d9d11 ("panvk: Collect allocated push
sets at the command level")

Fixed:
dEQP-VK.wsi.wayland.swapchain.simulate_oom.*

Signed-off-by: Ryan Zhang <ryan.zhang@nxp.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
(cherry picked from commit 418e6c4ed9)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Ryan Zhang 2026-02-13 12:20:21 +08:00 committed by Eric Engestrom
parent 11db64a7d3
commit 96ee7156af
2 changed files with 5 additions and 6 deletions

View file

@ -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

View file

@ -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;