zfs/module/os
Jorgen Lundman 3ad8826585 Avoid calling rw_destroy() on uninitialized rwlock
First the function `memset(&key, 0, ...)` but
any call to "goto error;" would call zio_crypt_key_destroy(key) which
calls `rw_destroy()`. The `rw_init()` is moved up to be right after the
memset. This way the rwlock can be released.

The ctx does allocate memory, but that is handled by the memset to 0
and icp skips NULL ptrs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #13976
2024-02-21 13:35:13 -08:00
..
freebsd Cleanup: Replace oldstyle struct hack with C99 flexible array members 2023-09-20 10:10:41 -07:00
linux Avoid calling rw_destroy() on uninitialized rwlock 2024-02-21 13:35:13 -08:00