HomeFreeBSD

abd_return_buf() should call zfs_refcount_remove_many() early

Description

abd_return_buf() should call zfs_refcount_remove_many() early

Calling zfs_refcount_remove_many() after freeing memory means we pass a
reference to freed memory as the holder. This is not believed to be able
to cause a problem, but there is a bit of a tradition of fixing these
issues when they appear so that they do not obscure more serious issues
in static analyzer output, so we fix this one too.

Clang's static analyzer found this with the help of CodeChecker's CTU
analysis.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14043

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Oct 16 2022, 4:02 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Oct 20 2022, 12:11 AM
Parents
rGc77d2d741571: crypto_get_ptrs() should always write to *out_data_2
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGd692e6c36e1a: abd_return_buf() should call zfs_refcount_remove_many() early (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Oct 20 2022, 12:11 AM