Page MenuHomeFreeBSD

vfs_lookup_cross_mount(): Fix reference counting/locking on LK_UPGRADE error
ClosedPublic

Authored by olce on Sep 5 2023, 12:58 PM.
Tags
None
Referenced Files
F102122649: D41731.diff
Thu, Nov 7, 9:45 PM
Unknown Object (File)
Sun, Oct 13, 11:21 AM
Unknown Object (File)
Sep 10 2024, 1:50 AM
Unknown Object (File)
Sep 4 2024, 7:31 PM
Unknown Object (File)
Aug 26 2024, 1:28 PM
Unknown Object (File)
Aug 18 2024, 12:25 AM
Unknown Object (File)
Aug 5 2024, 9:37 PM
Unknown Object (File)
Jul 25 2024, 1:57 AM
Subscribers

Details

Summary

Factoring out this code unfortunately introduced reference and lock leaks in
case of failure in the lock upgrade path under VV_CROSSLOCK. In terms of
practical use, this impacts unionfs (and nullfs in a corner case).

Also, add under INVARIANTS a check about the return value of vn_lock() (it is
not supposed to be anything else than ENOENT).

Fixes: 80bd5ef07025 vfs: factor out mount point traversal to a dedicated routine
MFC after: 3 days
MFC to: stable/14 releng/14.0
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Sep 5 2023, 12:58 PM
olce edited the summary of this revision. (Show Details)

Add an MPASS() on error, change a bit the commit message.

I found the bug around hte next day after introducing it, it must have slipped through the cracks afterwards.

I'll sort this review out over the weekend, thanks for submitting.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 22 2023, 9:00 PM
This revision was automatically updated to reflect the committed changes.