Date: Fri, 5 Jun 2015 16:02:08 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r284027 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <201506051602.t55G28l5086744@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Fri Jun 5 16:02:07 2015 New Revision: 284027 URL: https://svnweb.freebsd.org/changeset/base/284027 Log: MFC r283524: dsl_dataset_promote_check: ensure that shared snaps do not become too long Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Jun 5 15:51:23 2015 (r284026) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Jun 5 16:02:07 2015 (r284027) @@ -2088,12 +2088,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 (hds->ds_phys->ds_flags & DS_FLAG_NOPROMOTE) { promote_rele(ddpa, FTAG); @@ -2156,6 +2158,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?201506051602.t55G28l5086744>