summaryrefslogtreecommitdiff
path: root/usr/src/lib/libzfs/common/libzfs_dataset.c
diff options
context:
space:
mode:
authorloli10K <ezomori.nozomu@gmail.com>2017-05-05 19:19:13 +0200
committerPrakash Surya <prakash.surya@delphix.com>2017-06-07 18:55:42 -0700
commit690031d326342fa4ea28b5e80f1ad6a16281519d (patch)
tree75f11ed76e3bab9a330c8519e05878fd112aa97c /usr/src/lib/libzfs/common/libzfs_dataset.c
parent7c4ab494ff60bbbcc0889e71388ae63e903bbf57 (diff)
downloadillumos-joyent-690031d326342fa4ea28b5e80f1ad6a16281519d.tar.gz
8168 NULL pointer dereference in zfs_create()
Reviewed by: Matt Ahrens <mahrens@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libzfs/common/libzfs_dataset.c')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index a01d29e8c1..33803630a1 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -3271,6 +3271,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
char errbuf[1024];
uint64_t zoned;
enum lzc_dataset_type ost;
+ zpool_handle_t *zpool_handle;
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot create '%s'"), path);
@@ -3310,7 +3311,8 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
if (p != NULL)
*p = '\0';
- zpool_handle_t *zpool_handle = zpool_open(hdl, pool_path);
+ if ((zpool_handle = zpool_open(hdl, pool_path)) == NULL)
+ return (-1);
if (props && (props = zfs_valid_proplist(hdl, type, props,
zoned, NULL, zpool_handle, errbuf)) == 0) {