From c95ef9e3232ef35da3b3d7a77d0726d0cde3fe23 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Fri, 16 Aug 2024 11:04:01 +0200 Subject: [PATCH] panvk: Fix NULL deref on model name when device isn't supported Instead of reproting an VK_ERROR_INCOMPATIBLE_DRIVER we were crashing as device->model was init after this error check. Tested on G57 but should work the same on all unsupported arch. Signed-off-by: Mary Guillemard Fixes: f7f9b3d170f5 ("panvk: Move to vk_properties") Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/vulkan/panvk_physical_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 3603d8e7dd5..a5f4381dec4 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -693,6 +693,9 @@ panvk_physical_device_init(struct panvk_physical_device *device, pan_kmod_dev_query_props(device->kmod.dev, &device->kmod.props); + device->model = panfrost_get_model(device->kmod.props.gpu_prod_id, + device->kmod.props.gpu_variant); + unsigned arch = pan_arch(device->kmod.props.gpu_prod_id); if (arch <= 5 || arch >= 8) { @@ -710,8 +713,6 @@ panvk_physical_device_init(struct panvk_physical_device *device, device->master_fd = master_fd; - device->model = panfrost_get_model(device->kmod.props.gpu_prod_id, - device->kmod.props.gpu_variant); device->formats.all = panfrost_format_table(arch); device->formats.blendable = panfrost_blendable_format_table(arch);