mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 07:21:37 +00:00
dm: check pci_vdev before using
acrn-dm runs to segmentation fault when failed to create VMs with improper parameters. If vdevs failed to be created, they are still be freed in deinit(), and dereference the null pointers leads to segfault. Signed-off-by: Xinyun Liu <xinyun.liu@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
685d82cdcc
commit
fb723efa48
@ -821,7 +821,7 @@ static void
|
||||
pci_emul_deinit(struct vmctx *ctx, struct pci_vdev_ops *ops, int bus, int slot,
|
||||
int func, struct funcinfo *fi)
|
||||
{
|
||||
if (ops->vdev_deinit)
|
||||
if (ops->vdev_deinit && fi->fi_devi)
|
||||
(*ops->vdev_deinit)(ctx, fi->fi_devi, fi->fi_param);
|
||||
if (fi->fi_param)
|
||||
free(fi->fi_param);
|
||||
|
Loading…
Reference in New Issue
Block a user