Skip to content

Commit

Permalink
Fix several bugs in the FreeBSD rename VOP implementation
Browse files Browse the repository at this point in the history
- To avoid a use-after-free, zfsvfs->z_log needs to be loaded after the
  teardown lock is acquired with ZFS_ENTER().
- Avoid leaking vnode locks in zfs_rename_relock() and zfs_rename_()
  when the ZFS_ENTER() macros forces an early return.

Refactor the rename implementation so that ZFS_ENTER() can be used
safely.  As a bonus, this lets us use the ZFS_VERIFY_ZP() macro instead
of open-coding its implementation.

Reported-by: Peter Holm <[email protected]>
Tested-by: Peter Holm <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Tony Nguyen <[email protected]>
Signed-off-by: Mark Johnston <[email protected]>
Sponsored-by: The FreeBSD Foundation
Closes openzfs#12717
  • Loading branch information
markjdb authored and tonyhutter committed Dec 13, 2021
1 parent 47f098d commit 57f4373
Showing 1 changed file with 134 additions and 136 deletions.
Loading

0 comments on commit 57f4373

Please sign in to comment.