From 32f0add8713aa284256d6fd48cba45b2233bf7ab Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Tue, 4 Feb 2025 10:08:37 +0100 Subject: [PATCH] panvk: Disallow unknown GPU models early in physical device init We rely on the panfrost_model details around the codebase, if it's not known this is a problem. As a result, we will now disallow anything that isn't known like what we do on Gallium. Fixes: c95ef9e3232e ("panvk: Fix NULL deref on model name when device isn't supported") Signed-off-by: Mary Guillemard Suggested-by: Lars-Ivar Hesselberg Simonsen Reviewed-by: Lars-Ivar Hesselberg Simonsen Reviewed-by: Boris Brezillon Reviewed-by: Erik Faye-Lund Part-of: (cherry picked from commit e3b8d1da6dc4819cd5fdbea9bdae08d98f7de588) --- .pick_status.json | 2 +- src/panfrost/vulkan/panvk_physical_device.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 58bc7e187c0..c0edaef3ad0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -94,7 +94,7 @@ "description": "panvk: Disallow unknown GPU models early in physical device init", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c95ef9e3232ef35da3b3d7a77d0726d0cde3fe23", "notes": null diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 8124da9259f..a3aadb58a14 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -905,6 +905,14 @@ panvk_physical_device_init(struct panvk_physical_device *device, unsigned arch = pan_arch(device->kmod.props.gpu_prod_id); + if (!device->model) { + result = panvk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER, + "Unknown gpu_id (%#x) or variant (%#x)", + device->kmod.props.gpu_prod_id, + device->kmod.props.gpu_variant); + goto fail; + } + switch (arch) { case 6: case 7: