From e3b8d1da6dc4819cd5fdbea9bdae08d98f7de588 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: --- src/panfrost/vulkan/panvk_physical_device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 17d1b925e82..ecc22ba0325 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -911,6 +911,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: