diff options
author | Toomas Soome <tsoome@me.com> | 2016-12-17 02:12:02 +0200 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2017-01-05 13:50:48 -0800 |
commit | c2c0835a754ef6f7e4546d9f3fd92174c265981f (patch) | |
tree | f074d43a373f966609a2b56da0606a2fe6632997 | |
parent | 54d02241ceb89d90c765e528622d88f84f65dab3 (diff) | |
download | illumos-joyent-c2c0835a754ef6f7e4546d9f3fd92174c265981f.tar.gz |
7673 uts: strplumb is used before it is initialized
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r-- | usr/src/uts/common/fs/vfs.c | 7 | ||||
-rw-r--r-- | usr/src/uts/common/io/strplumb.c | 20 |
2 files changed, 17 insertions, 10 deletions
diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c index 56834594fe..c50fe824ad 100644 --- a/usr/src/uts/common/fs/vfs.c +++ b/usr/src/uts/common/fs/vfs.c @@ -4631,7 +4631,6 @@ getfsname(char *askfor, char *name, size_t namelen) static void getrootfs(char **fstypp, char **fsmodp) { - extern char *strplumb_get_netdev_path(void); char *propstr = NULL; /* @@ -4681,11 +4680,7 @@ getrootfs(char **fstypp, char **fsmodp) (void) strncpy(rootfs.bo_name, propstr, BO_MAXOBJNAME); ddi_prop_free(propstr); } else { - /* attempt to determine netdev_path via boot_mac address */ - netdev_path = strplumb_get_netdev_path(); - if (netdev_path == NULL) - panic("cannot find boot network interface"); - (void) strncpy(rootfs.bo_name, netdev_path, BO_MAXOBJNAME); + rootfs.bo_name[0] = '\0'; } *fstypp = rootfs.bo_fstype; *fsmodp = "nfs"; diff --git a/usr/src/uts/common/io/strplumb.c b/usr/src/uts/common/io/strplumb.c index 1a3cb37248..d57bc150f5 100644 --- a/usr/src/uts/common/io/strplumb.c +++ b/usr/src/uts/common/io/strplumb.c @@ -214,8 +214,13 @@ int ndev_unit = 0; /* * If we booted diskless then strplumb() will have been called from - * swapgeneric.c:rootconf(). All we can do in that case is plumb the - * network device that we booted from. + * either: + * in case of x86 NEWBOOT: vfs.c:rootconf() + * in case of nfs root, the rootfs.bo_name is reset from /ramdisk:a + * to empty string and we will copy netdev_path there. + * or + * in case of sparc: swapgeneric.c:rootconf(). + * All we can do in that case is plumb the network device that we booted from. * * If we booted from a local disk, we will have been called from main(), * and normally we defer the plumbing of interfaces until network/physical. @@ -232,10 +237,17 @@ resolve_boot_path(void) char stripped_path[OBP_MAXPATHLEN]; #endif - if (strncmp(rootfs.bo_fstype, "nfs", 3) == 0) + if (strncmp(rootfs.bo_fstype, "nfs", 3) == 0 && + rootfs.bo_name[0] != '\0') { devpath = rootfs.bo_name; - else + } else { devpath = strplumb_get_netdev_path(); + netdev_path = devpath; + if (netdev_path != NULL) { + (void) strncpy(rootfs.bo_name, netdev_path, + BO_MAXOBJNAME); + } + } if (devpath != NULL) { DBG1("resolving boot-path: %s\n", devpath); |