Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jun 2015 17:08:32 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r284039 - vendor-sys/illumos/dist/uts/common/fs/zfs
Message-ID:  <201506051708.t55H8WA7020423@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri Jun  5 17:08:32 2015
New Revision: 284039
URL: https://svnweb.freebsd.org/changeset/base/284039

Log:
  5909 ensure that shared snap names don't become too long after promotion
  
  Author: Andriy Gapon <avg@freebsd.org>
  Reviewed by: George Wilson <george@delphix.com>
  Approved by: Dan McDonald <danmcd@omniti.com>
  
  illumos/illumos-gate@cb5842f8b0caaad0ed53535bd77042e933fdbafe

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c	Fri Jun  5 17:07:51 2015	(r284038)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c	Fri Jun  5 17:08:32 2015	(r284039)
@@ -2081,12 +2081,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);
@@ -2150,6 +2152,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?201506051708.t55H8WA7020423>