aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/contrib/opensolaris/common/zfs
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-11-09 18:12:21 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-11-09 18:12:21 +0000
commit2e06836feefe811754c587c72cc2283a691d6709 (patch)
tree3b9cd9a851ad046ce94d694f21022d90549e8642 /sys/cddl/contrib/opensolaris/common/zfs
parent0cf77199b25ce15663bea5cba321001b240002c4 (diff)
parent98b9b8cb4bcc0ea2f7b1e52b03b1d94d0c1d4475 (diff)
downloadsrc-2e06836feefe811754c587c72cc2283a691d6709.tar.gz
src-2e06836feefe811754c587c72cc2283a691d6709.zip
MFV r325605: 8713 Buffer overflow in dsl_dataset_name()
illumos/illumos-gate@f37ae9a714b97eca91c74c680c20c750c7cf5c02 https://github.com/illumos/illumos-gate/commit/f37ae9a714b97eca91c74c680c20c750c7cf5c02 https://www.illumos.org/issues/8713 If we're creating a pool with version >= SPA_VERSION_DSL_SCRUB (v11) we need to account for additional space needed by the origin dataset which will also be snapshotted: "poolname"+"/"+"$ORIGIN"+"@"+"$ORIGIN". Enforce this limit in pool_namecheck(). Reviewed by: Prakash Surya <prakash.surya@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Dan McDonald <danmcd@joyent.com> Author: loli10K <ezomori.nozomu@gmail.com> MFC after: 1 week
Notes
Notes: svn path=/head/; revision=325606
Diffstat (limited to 'sys/cddl/contrib/opensolaris/common/zfs')
-rw-r--r--sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c b/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
index 950d41f353ac..09975125261b 100644
--- a/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
+++ b/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
@@ -44,6 +44,7 @@
#include <string.h>
#endif
+#include <sys/dsl_dir.h>
#include <sys/param.h>
#include <sys/nvpair.h>
#include "zfs_namecheck.h"
@@ -301,8 +302,14 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
/*
* Make sure the name is not too long.
+ * If we're creating a pool with version >= SPA_VERSION_DSL_SCRUB (v11)
+ * we need to account for additional space needed by the origin ds which
+ * will also be snapshotted: "poolname"+"/"+"$ORIGIN"+"@"+"$ORIGIN".
+ * Play it safe and enforce this limit even if the pool version is < 11
+ * so it can be upgraded without issues.
*/
- if (strlen(pool) >= ZFS_MAX_DATASET_NAME_LEN) {
+ if (strlen(pool) >= (ZFS_MAX_DATASET_NAME_LEN - 2 -
+ strlen(ORIGIN_DIR_NAME) * 2)) {
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);