ACRN:DM:VGPU: Fix the incorrect use after free

It still tries to access the gpu->vdpy_handel after the gpu
is free. This is incorrect.

Tracked-On: #7337
Acked-by: Wang Yu <yu1.wang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
Zhao Yakui 2022-04-21 15:46:51 +08:00 committed by acrnsi-robot
parent 2a7a269313
commit 8b7767e643
1 changed files with 2 additions and 1 deletions

View File

@ -1680,12 +1680,13 @@ virtio_gpu_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
}
}
vdpy_deinit(gpu->vdpy_handle);
if (gpu) {
pthread_mutex_destroy(&gpu->mtx);
free(gpu);
}
virtio_gpu_device_cnt--;
vdpy_deinit(gpu->vdpy_handle);
}
uint64_t