Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hv: check the validity of 'pdev' in 'set_ptdev_intr_info'
 This patch checks the validity of 'vdev->pdev' to
 ensure physical device is linked to 'vdev'.
 this check is to avoid some potential hypervisor
 crash when destroying VM with crafted input.

Tracked-On: #4336
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
  • Loading branch information
yonghuah authored and wenlingz committed Jan 9, 2020
1 parent fe03d87 commit 82b89fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hypervisor/dm/vpci/vpci.c
Expand Up @@ -581,7 +581,7 @@ void vpci_set_ptdev_intr_info(struct acrn_vm *target_vm, uint16_t vbdf, uint16_t
sos_vm = get_sos_vm();
spinlock_obtain(&sos_vm->vpci.lock);
vdev = pci_find_vdev(&sos_vm->vpci, bdf);
if (vdev == NULL) {
if ((vdev == NULL) || (vdev->pdev == NULL)) {
pr_err("%s, can't find PCI device for vm%d, vbdf (0x%x) pbdf (0x%x)", __func__,
target_vm->vm_id, vbdf, pbdf);
} else {
Expand Down

0 comments on commit 82b89fd

Please sign in to comment.