Skip to content

Commit

Permalink
Better error for attaching a PCI device to dom0
Browse files Browse the repository at this point in the history
Previously, this would result in an internal error in qubesd.
  • Loading branch information
DemiMarie committed Dec 31, 2021
1 parent 069970e commit 0918fc8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qubes/ext/pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ def on_device_pre_attached_pci(self, vm, event, device, options):
raise qubes.exc.QubesException(
'Invalid PCI device: {}'.format(device.ident))

if isinstance(vm, qubes.vm.adminvm.AdminVM):
raise qubes.exc.QubesException("Can't attach PCI device to dom0")

if vm.virt_mode == 'pvh':
raise qubes.exc.QubesException(
"Can't attach PCI device to VM in pvh mode")
Expand Down

0 comments on commit 0918fc8

Please sign in to comment.