From 4ac91ff1fac0d240b04196d4e609f1242c8af5ee Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Tue, 18 Mar 2025 16:01:47 -0700 Subject: [PATCH] [PATCH] gfxstream: check device exists before using it Segfaults in the error case otherwise. Cc: mesa-stable Reviewed-by: Aaron Ruby Gbp-Pq: Name gfxstream-check-device-before-using.diff --- .../guest/connection-manager/GfxStreamConnectionManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gfxstream/guest/connection-manager/GfxStreamConnectionManager.cpp b/src/gfxstream/guest/connection-manager/GfxStreamConnectionManager.cpp index 31a950522..8139853e9 100644 --- a/src/gfxstream/guest/connection-manager/GfxStreamConnectionManager.cpp +++ b/src/gfxstream/guest/connection-manager/GfxStreamConnectionManager.cpp @@ -70,6 +70,11 @@ bool GfxStreamConnectionManager::initialize() { // Use kCapsetGfxStreamVulkan for now, Ranchu HWC needs to be modified to pass in // right capset. auto device = VirtGpuDevice::getInstance(kCapsetGfxStreamVulkan); + if (!device) { + mesa_logd("Failed to get VirtGpuDevice\n"); + return false; + } + mDescriptor = device->getDeviceHandle(); mStream = createVirtioGpuAddressSpaceStream(kCapsetGfxStreamVulkan); if (!mStream) { -- 2.30.2