summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>2023-03-04 10:39:15 +0530
committerEric Engestrom <eric@engestrom.ch>2023-03-08 18:00:15 +0000
commit3215dd37b9a7d71a3fcbeca797a41f8da2af8377 (patch)
tree6cee51f3511f196719887340deabfc9f67f1d1ad
parentca25ff5d50dead6d1f151bfd77a06afa45f6deff (diff)
downloadmesa-3215dd37b9a7d71a3fcbeca797a41f8da2af8377.tar.gz
wsi/display: check alloc failure in wsi_display_alloc_connector()
vulkancts test dEQP-VK.wsi.direct_drm.surface.create_simulate_oom is failing because in wsi_display_alloc_connector() function memory allocation for connector is not checked for return NULL. create_simulate_oom test simulates out of memory, hence memory allocation fails for connector and later when tried to dereference connector program will segfault. This patch fixes the dEQP-VK.wsi.direct_drm.surface.create_simulate_oom test segfault issue by checking if connector is NULL afer memory allocation. Cc: mesa-stable Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21701> (cherry picked from commit af953616a10ad8b122b1d3906b855c0a5f9fbfa7)
-rw-r--r--.pick_status.json2
-rw-r--r--src/vulkan/wsi/wsi_common_display.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index d70615377d8..e4dc71f1231 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2173,7 +2173,7 @@
"description": "wsi/display: check alloc failure in wsi_display_alloc_connector()",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index 0e5d27278b1..4d92cd13c14 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -294,6 +294,8 @@ wsi_display_alloc_connector(struct wsi_display *wsi,
struct wsi_display_connector *connector =
vk_zalloc(wsi->alloc, sizeof (struct wsi_display_connector),
8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
+ if (!connector)
+ return NULL;
connector->id = connector_id;
connector->wsi = wsi;