Fix crash caused by invalid snapshot names in redactnvl

This is a follow up fix for commit 0fdd6106bb.  The VERIFY is
only true when we haven't hit an error code path.  See added
test case for a reproducer.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Christian Schwarz <me@cschwarz.com>
Closes #11048
This commit is contained in:
Christian Schwarz 2020-10-14 23:04:19 +02:00 committed by GitHub
parent 6a60ef80e2
commit 15a4ca4620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -1062,9 +1062,9 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
} }
} }
VERIFY3P(nvlist_next_nvpair(redactnvl, pair), ==, NULL);
if (err != 0) if (err != 0)
goto out; goto out;
VERIFY3P(nvlist_next_nvpair(redactnvl, pair), ==, NULL);
boolean_t resuming = B_FALSE; boolean_t resuming = B_FALSE;
zfs_bookmark_phys_t bookmark; zfs_bookmark_phys_t bookmark;

View File

@ -56,6 +56,8 @@ done
log_mustnot zfs redact $sendfs@snap1 log_mustnot zfs redact $sendfs@snap1
log_mustnot zfs redact $sendfs@snap1 book log_mustnot zfs redact $sendfs@snap1 book
log_mustnot zfs redact $sendfs#book1 book4 $clone1 log_mustnot zfs redact $sendfs#book1 book4 $clone1
log_mustnot zfs redact $sendfs@snap1 book snap2 snap3
log_mustnot zfs redact $sendfs@snap1 book @snap2 @snap3
log_mustnot eval "zfs send --redact $sendfs#book $sendfs@snap >/dev/null" log_mustnot eval "zfs send --redact $sendfs#book $sendfs@snap >/dev/null"
# Redaction snapshots not a descendant of tosnap # Redaction snapshots not a descendant of tosnap