summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAlex Wilson <alex.wilson@joyent.com>2015-08-11 23:04:27 +0000
committerAlex Wilson <alex.wilson@joyent.com>2015-08-13 09:10:19 -0700
commit46835c1dcc9ab3eca8be681d7f43a9575f10d7e5 (patch)
treed5de6f44f87f33f8ba1a30ed3c4afef3654a9807 /usr/src
parent227c54b6c705cde422e89b95ede04320a79a0934 (diff)
downloadillumos-joyent-46835c1dcc9ab3eca8be681d7f43a9575f10d7e5.tar.gz
OS-3620 sdev can create bogus zvol directories
Reviewed by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/fs/dev/sdev_zvolops.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr/src/uts/common/fs/dev/sdev_zvolops.c b/usr/src/uts/common/fs/dev/sdev_zvolops.c
index 85d9ab64cb..3fa98b3124 100644
--- a/usr/src/uts/common/fs/dev/sdev_zvolops.c
+++ b/usr/src/uts/common/fs/dev/sdev_zvolops.c
@@ -197,8 +197,13 @@ devzvol_objset_check(char *dsname, dmu_objset_type_t *type)
}
/*
- * returns what the zfs dataset name should be, given the /dev/zvol
- * path and an optional name; otherwise NULL
+ * Returns what the zfs dataset name should be, given the /dev/zvol
+ * path and an optional name (can be NULL).
+ *
+ * Note that if the name param is NULL, then path must be an
+ * actual dataset's directory and not one of the top-level
+ * /dev/zvol/{dsk,rdsk} dirs, as these do not correspond to a
+ * specific dataset.
*/
char *
devzvol_make_dsname(const char *path, const char *name)
@@ -218,8 +223,11 @@ devzvol_make_dsname(const char *path, const char *name)
ptr += strlen("/rdsk");
else
return (NULL);
+
if (*ptr == '/')
ptr++;
+ else if (name == NULL)
+ return (NULL);
dslen = strlen(ptr);
if (dslen)