Page MenuHomeFreeBSD

2/3 vfs: fix device count leak on vrele racing with vgone
ClosedPublic

Authored by mjg on Feb 6 2020, 12:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 30, 11:30 AM
Unknown Object (File)
Sun, Apr 19, 5:04 AM
Unknown Object (File)
Apr 14 2026, 10:27 PM
Unknown Object (File)
Apr 9 2026, 9:45 PM
Unknown Object (File)
Apr 6 2026, 8:23 AM
Unknown Object (File)
Mar 31 2026, 12:34 AM
Unknown Object (File)
Mar 28 2026, 12:46 AM
Unknown Object (File)
Mar 24 2026, 4:24 AM
Subscribers

Details

Summary

The race is:

CPU1                                        CPU2
                                    devfs_reclaim_vchr
make v_usecount 0
                                      VI_LOCK
                                      sees v_usecount == 0, no updates
                                      vp->v_rdev = NULL;
                                      ...
                                      VI_UNLOCK
VI_LOCK
v_decr_devcount
  sees v_rdev == NULL, no updates

In this scenario si_devcount decrement is not performed.

Note this can only happen if the vnode lock is not held.

Also see the 3/3 review.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable