diff --git a/module/os/linux/zfs/zio_crypt.c b/module/os/linux/zfs/zio_crypt.c index ce2c987d71..3860885292 100644 --- a/module/os/linux/zfs/zio_crypt.c +++ b/module/os/linux/zfs/zio_crypt.c @@ -249,6 +249,7 @@ zio_crypt_key_init(uint64_t crypt, zio_crypt_key_t *key) #pragma GCC diagnostic pop #endif memset(key, 0, sizeof (zio_crypt_key_t)); + rw_init(&key->zk_salt_lock, NULL, RW_DEFAULT, NULL); /* fill keydata buffers and salt with random data */ ret = random_get_bytes((uint8_t *)&key->zk_guid, sizeof (uint64_t)); @@ -302,7 +303,6 @@ zio_crypt_key_init(uint64_t crypt, zio_crypt_key_t *key) key->zk_crypt = crypt; key->zk_version = ZIO_CRYPT_KEY_CURRENT_VERSION; key->zk_salt_count = 0; - rw_init(&key->zk_salt_lock, NULL, RW_DEFAULT, NULL); return (0);