changeset 12270:eada45a1a0be

6945467 AI image fails to boot in x86 machines due to devfsadm -r core dump in snv_138
author Jerry Gilliam <Jerry.Gilliam@Sun.COM>
date Tue, 27 Apr 2010 12:57:25 -0700
parents 8217c3354cee
children 084c4473d1ed
files usr/src/cmd/devfsadm/devfsadm.c usr/src/lib/libdevinfo/devinfo.c
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/devfsadm/devfsadm.c	Tue Apr 27 09:48:22 2010 -0700
+++ b/usr/src/cmd/devfsadm/devfsadm.c	Tue Apr 27 12:57:25 2010 -0700
@@ -4481,10 +4481,11 @@
 	/* We *don't* want a stat of the /devices node */
 	path = NULL;
 	(void) resolve_link(devlink, NULL, NULL, &path, 0);
-
-	/* redirect if alias to current */
-	*devfs_path = di_alias2curr(anynode, path);
-	free(path);
+	if (path != NULL) {
+		/* redirect if alias to current */
+		*devfs_path = di_alias2curr(anynode, path);
+		free(path);
+	}
 	return (*devfs_path ? DEVFSADM_SUCCESS : DEVFSADM_FAILURE);
 }
 
--- a/usr/src/lib/libdevinfo/devinfo.c	Tue Apr 27 09:48:22 2010 -0700
+++ b/usr/src/lib/libdevinfo/devinfo.c	Tue Apr 27 12:57:25 2010 -0700
@@ -3710,7 +3710,8 @@
 
 	*nodep = NULL;
 
-	assert(anynode != DI_NODE_NIL);
+	if (anynode == DI_NODE_NIL || devfspath == NULL)
+		return (NULL);
 
 	pa = (caddr_t)anynode - DI_NODE(anynode)->self;
 	all = DI_ALL(pa);
@@ -3858,8 +3859,12 @@
 di_alias2curr(di_node_t anynode, char *alias)
 {
 	di_node_t currnode = DI_NODE_NIL;
-	char *curr = alias_to_curr(anynode, alias, &currnode);
-
+	char *curr;
+
+	if (anynode == DI_NODE_NIL || alias == NULL)
+		return (NULL);
+
+	curr = alias_to_curr(anynode, alias, &currnode);
 	if (curr == NULL && currnode != DI_NODE_NIL) {
 		return (di_devfs_path(currnode));
 	} else if (curr == NULL) {