From owner-svn-src-stable-10@freebsd.org Thu Nov 16 22:47:42 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F9B7DEBE79; Thu, 16 Nov 2017 22:47:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 289606EDE8; Thu, 16 Nov 2017 22:47:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAGMlfl0055103; Thu, 16 Nov 2017 22:47:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAGMlfuv055102; Thu, 16 Nov 2017 22:47:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711162247.vAGMlfuv055102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 16 Nov 2017 22:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325910 - stable/10/sys/cddl/contrib/opensolaris/common/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/common/zfs X-SVN-Commit-Revision: 325910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2017 22:47:42 -0000 Author: avg Date: Thu Nov 16 22:47:41 2017 New Revision: 325910 URL: https://svnweb.freebsd.org/changeset/base/325910 Log: MFC r325606: MFV r325605: 8713 Buffer overflow in dsl_dataset_name() Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Thu Nov 16 22:44:51 2017 (r325909) +++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c Thu Nov 16 22:47:41 2017 (r325910) @@ -44,6 +44,7 @@ #include #endif +#include #include #include #include "zfs_namecheck.h" @@ -296,8 +297,14 @@ pool_namecheck(const char *pool, namecheck_err_t *why, /* * 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);