Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2015 11:48:16 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283524 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201505251148.t4PBmGL4079465@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Mon May 25 11:48:15 2015
New Revision: 283524
URL: https://svnweb.freebsd.org/changeset/base/283524

Log:
  dsl_dataset_promote_check: ensure that shared snaps do not become too long
  
  ... after they are transfered from the old origin to the new one.
  
  See:	https://www.illumos.org/issues/5909
  See:	https://reviews.csiden.org/r/219/
  
  Reviewed by:	mahrens
  MFC after:	10 days
  Sponsored by:	ClusterHQ

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Mon May 25 11:36:14 2015	(r283523)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Mon May 25 11:48:15 2015	(r283524)
@@ -2161,12 +2161,14 @@ dsl_dataset_promote_check(void *arg, dmu
 	int err;
 	uint64_t unused;
 	uint64_t ss_mv_cnt;
+	size_t max_snap_len;
 
 	err = promote_hold(ddpa, dp, FTAG);
 	if (err != 0)
 		return (err);
 
 	hds = ddpa->ddpa_clone;
+	max_snap_len = MAXNAMELEN - strlen(ddpa->ddpa_clonename) - 1;
 
 	if (dsl_dataset_phys(hds)->ds_flags & DS_FLAG_NOPROMOTE) {
 		promote_rele(ddpa, FTAG);
@@ -2230,6 +2232,10 @@ dsl_dataset_promote_check(void *arg, dmu
 
 		/* Check that the snapshot name does not conflict */
 		VERIFY0(dsl_dataset_get_snapname(ds));
+		if (strlen(ds->ds_snapname) >= max_snap_len) {
+			err = SET_ERROR(ENAMETOOLONG);
+			goto out;
+		}
 		err = dsl_dataset_snap_lookup(hds, ds->ds_snapname, &val);
 		if (err == 0) {
 			(void) strcpy(ddpa->err_ds, snap->ds->ds_snapname);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505251148.t4PBmGL4079465>