From 690031d326342fa4ea28b5e80f1ad6a16281519d Mon Sep 17 00:00:00 2001 From: loli10K Date: Fri, 5 May 2017 19:19:13 +0200 Subject: 8168 NULL pointer dereference in zfs_create() Reviewed by: Matt Ahrens Approved by: Robert Mustacchi --- usr/src/lib/libzfs/common/libzfs_dataset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr/src/lib/libzfs/common/libzfs_dataset.c') 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) { -- cgit v1.2.3