From 87a275d97aa5b7bb47c0601c8b005e8ae85be2f7 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Thu, 13 Apr 2017 14:32:08 -0700 Subject: [PATCH] OpenZFS 6101 - attempt to lzc_create() a filesystem under a volume results in a panic Authored by: Andriy Gapon Approved by: Dan McDonald Reviewed by: Matthew Ahrens Reviewed-by: Brian Behlendorf Ported-by: Giuseppe Di Natale When querying ZPL properties verify that the objset is of type DMU_OST_ZFS. OpenZFS-issue: https://www.illumos.org/issues/6101 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ce2243a Closes #6015 --- module/zfs/zfs_ioctl.c | 3 +++ module/zfs/zfs_vfsops.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 534df5a06..109762795 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -2998,6 +2998,9 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver, ASSERT(zplprops != NULL); + if (os != NULL && os->os_phys->os_type != DMU_OST_ZFS) + return (SET_ERROR(EINVAL)); + /* * Pull out creator prop choices, if any. */ diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index 0b8214e0f..40fd5f764 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -2058,8 +2058,10 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value) else pname = zfs_prop_to_name(prop); - if (os != NULL) + if (os != NULL) { + ASSERT3U(os->os_phys->os_type, ==, DMU_OST_ZFS); error = zap_lookup(os, MASTER_NODE_OBJ, pname, 8, 1, value); + } if (error == ENOENT) { /* No value set, use the default value */ -- 2.49.0