HomeFreeBSD

Avoid calling rw_destroy() on uninitialized rwlock

Description

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

Details

Provenance
Jorgen Lundman <lundman@lundman.net>Authored on Oct 6 2022, 12:07 AM
GitHub <noreply@github.com>Committed on Oct 6 2022, 12:07 AM
Parents
rG062d3d056bf2: Remove ambiguity on demand vs prefetch stats reported by arc_summary
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG4b629d04a5b8: Avoid calling rw_destroy() on uninitialized rwlock (authored by Jorgen Lundman <lundman@lundman.net>).Oct 6 2022, 12:07 AM