summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2020-06-29 18:25:27 +0000
committerkn <kn@cvs.openbsd.org>2020-06-29 18:25:27 +0000
commit03ee3b4ce3a891f9243d1ec3ab0c1ff3a27977b6 (patch)
tree3cbb5e9e5b5755adf8bae9f9bbd183d16ce09e85 /usr.sbin
parent652326e1c6045dbbe8879b824e6b6e685bcb9edd (diff)
Fix "init-system" with multiple PCIe root complexes
Contrary to other (single CPU) machines, the Oracle SPARC T4-2 machines come with two CPUs/two PCIe root complexes instead of one. ldomctl already accounts for this and interates over them but lacked a skip condition when iterating over subdevices to avoid linking devices in one complex to those in another. This fixes a NULL dereference in "init-system" on T4-2 machines and makes it produce working machine descriptions (.md files). Testing and confirmation on a T4-1 that single PCIe root complex machines still produce identical MDs with this from tracey, thanks! Reminded by a report on bugs@ from Kokuma who also confirmed this fix on their T4-2.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ldomctl/config.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/ldomctl/config.c b/usr.sbin/ldomctl/config.c
index da289f0da51..acd8ae6e8b7 100644
--- a/usr.sbin/ldomctl/config.c
+++ b/usr.sbin/ldomctl/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.40 2020/05/24 22:08:54 kn Exp $ */
+/* $OpenBSD: config.c,v 1.41 2020/06/29 18:25:26 kn Exp $ */
/*
* Copyright (c) 2012, 2018 Mark Kettenis
@@ -1142,6 +1142,8 @@ hvmd_finalize_pcie_device(struct md *md, struct device *device)
md_link_node(md, node, parent);
TAILQ_FOREACH(subdevice, &device->guest->subdevice_list, link) {
+ if (strncmp(path, subdevice->path, strlen(path)) != 0)
+ continue;
TAILQ_FOREACH(component, &components, link) {
if (strcmp(subdevice->path, component->path) == 0)
md_link_node(md, parent, component->hv_node);