Double-free of encryption wrapping key due to invalid pool properties

This commits fixes a double-free in zfs_ioc_pool_create() triggered by
specifying an unsupported combination of properties when creating a pool
with encryption enabled.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #8791
This commit is contained in:
loli10K
2019-05-29 00:19:50 +02:00
committed by Brian Behlendorf
parent 27b446f799
commit aaf3b30dcf
2 changed files with 14 additions and 12 deletions
@@ -45,6 +45,7 @@
# N 1 1 no keyformat given, but crypt off
# Y 0 0 no no keyformat specified for new key
# Y 0 1 no no keyformat specified for new key
# Y 1 1 no unsupported combination of non-encryption props
# Y 1 0 yes new encryption root
# Y 1 1 yes new encryption root
#
@@ -83,6 +84,10 @@ log_mustnot zpool create -O encryption=on $TESTPOOL $DISKS
log_mustnot zpool create -O encryption=on -O keylocation=prompt \
$TESTPOOL $DISKS
log_mustnot eval "echo $PASSPHRASE | zpool create -O encryption=on" \
"-O keyformat=passphrase -O keylocation=prompt" \
"-o feature@lz4_compress=disabled -O compression=lz4 $TESTPOOL $DISKS"
log_must eval "echo $PASSPHRASE | zpool create -O encryption=on" \
"-O keyformat=passphrase $TESTPOOL $DISKS"
log_must zpool destroy $TESTPOOL