Properly release key in spa_keystore_dsl_key_hold_dd()

Since dsl_crypto_key_open() references the key, 0d23f5e2e4 should
have called dsl_crypto_key_rele() to drop it first instead of
calling dsl_crypto_key_free() directly.  The final result should
actually be the same, but without triggering dck_holds assertion.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #16567
This commit is contained in:
Alexander Motin 2024-09-25 10:40:17 -04:00 committed by GitHub
parent 832f66b218
commit 48d1be254f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -717,7 +717,7 @@ spa_keystore_dsl_key_hold_dd(spa_t *spa, dsl_dir_t *dd, const void *tag,
avl_insert(&spa->spa_keystore.sk_dsl_keys, dck_io, where);
*dck_out = dck_io;
} else {
dsl_crypto_key_free(dck_io);
dsl_crypto_key_rele(dck_io, tag);
*dck_out = dck_ks;
}