summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorAndriy Gapon <[email protected]>2015-07-02 16:04:17 +0300
committerBrian Behlendorf <[email protected]>2015-07-06 09:21:30 -0700
commitfec417097b0289fb7c1c34cc919fefa48786d20c (patch)
tree7ecc8d6619945268bc3ab96cb2dd60206d0c6168 /module/zfs
parentcf50a2b08ff66114a72f6d6d12f13439cd5c5b99 (diff)
Illumos 5909 - ensure that shared snap names don't become too long after promotion
5909 ensure that shared snap names don't become too long after promotion Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5909 https://github.com/illumos/illumos-gate/commit/cb5842f Ported-by: Andriy Gapon <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3550
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dsl_dataset.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index dacb6678e..f382f5a07 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -2131,12 +2131,14 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
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);
@@ -2200,6 +2202,10 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
/* 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);