[PATCH] gfxstream: check device exists before using it
authorGurchetan Singh <gurchetansingh@google.com>
Tue, 18 Mar 2025 23:01:47 +0000 (16:01 -0700)
committerTimo Aaltonen <tjaalton@debian.org>
Thu, 3 Apr 2025 10:47:45 +0000 (13:47 +0300)
Segfaults in the error case otherwise.

Cc: mesa-stable
Reviewed-by: Aaron Ruby <aruby@qnx.com>
Gbp-Pq: Name gfxstream-check-device-before-using.diff

src/gfxstream/guest/connection-manager/GfxStreamConnectionManager.cpp

index 31a950522fc6bbcfd0649c952586eb01c5edd0a3..8139853e923de2f8f755a0fa621e5e04f70077d3 100644 (file)
@@ -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) {