提交 bd128896 编写于 作者: S Shivaprasad G Bhat 提交者: Martin Kletzander

util: Forbid resetting non-endpoint devices

It is destructive to attempt reset on a pci- or cardbus-bridge, the
host can crash.  The bridges won't contain any guest data and neither
they can be passed through using vfio/stub.  So, no point in allowing a
reset on them.
Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
上级 bec9b9b0
......@@ -933,6 +933,18 @@ virPCIDeviceReset(virPCIDevicePtr dev,
char *drvName = NULL;
int ret = -1;
int fd = -1;
int hdrType = -1;
if (virPCIGetHeaderType(dev, &hdrType) < 0)
return -1;
if (hdrType != VIR_PCI_HEADER_ENDPOINT) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid attempt to reset PCI device %s. "
"Only PCI endpoint devices can be reset"),
dev->name);
return -1;
}
if (activeDevs && virPCIDeviceListFind(activeDevs, dev)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册