summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/devinfo.c
diff options
context:
space:
mode:
authorcth <none@none>2005-10-04 13:57:06 -0700
committercth <none@none>2005-10-04 13:57:06 -0700
commitdc03c5673bc53b21c17fc4f6766bffa09237fc18 (patch)
tree1190d30e6f76a8863b2bef3cd7d96edcb0d6be4a /usr/src/uts/common/io/devinfo.c
parente6cafd9189c9f5aceb474c07a1c61dcc5b1c4ae5 (diff)
downloadillumos-joyent-dc03c5673bc53b21c17fc4f6766bffa09237fc18.tar.gz
6183314 workaround for obp bug 6183312 needed
Diffstat (limited to 'usr/src/uts/common/io/devinfo.c')
-rw-r--r--usr/src/uts/common/io/devinfo.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr/src/uts/common/io/devinfo.c b/usr/src/uts/common/io/devinfo.c
index bdcd90a038..ec6ba40b05 100644
--- a/usr/src/uts/common/io/devinfo.c
+++ b/usr/src/uts/common/io/devinfo.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1254,11 +1254,33 @@ di_snapshot(struct di_state *st)
struct di_all *all;
dev_info_t *rootnode;
char buf[80];
+ int plen;
+ char *path;
+ vnode_t *vp;
all = (struct di_all *)di_mem_addr(st, 0);
dcmn_err((CE_CONT, "Taking a snapshot of devinfo tree...\n"));
/*
+ * Verify path before entrusting it to e_ddi_hold_devi_by_path because
+ * some platforms have OBP bugs where executing the NDI_PROMNAME code
+ * path against an invalid path results in panic. The lookupnameat
+ * is done relative to rootdir without a leading '/' on "devices/"
+ * to force the lookup to occur in the global zone.
+ */
+ plen = strlen("devices/") + strlen(all->root_path) + 1;
+ path = kmem_alloc(plen, KM_SLEEP);
+ (void) snprintf(path, plen, "devices/%s", all->root_path);
+ if (lookupnameat(path, UIO_SYSSPACE, FOLLOW, NULLVPP, &vp, rootdir)) {
+ dcmn_err((CE_CONT, "Devinfo node %s not found\n",
+ all->root_path));
+ kmem_free(path, plen);
+ return (0);
+ }
+ kmem_free(path, plen);
+ VN_RELE(vp);
+
+ /*
* Hold the devinfo node referred by the path.
*/
rootnode = e_ddi_hold_devi_by_path(all->root_path, 0);