]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fdescfs: Fix a file ref leak
authorMark Johnston <markj@FreeBSD.org>
Wed, 22 Mar 2023 12:52:57 +0000 (08:52 -0400)
committerMark Johnston <markj@FreeBSD.org>
Wed, 22 Mar 2023 13:19:27 +0000 (09:19 -0400)
commit0f5b6f9a041e9cca3b376f6ec909374938887a3b
tree401f8bd0dfa22d33bdc51c4f73411633086e2315
parente5e1d9c7b781470b2eb31d80f40927481e0053b8
fdescfs: Fix a file ref leak

In fdesc_lookup(), vn_vget_ino_gen() may fail without invoking the
callback, in which case the ref on fp is leaked.  This happens if the
fdescfs mount is being concurrently unmounted.  Moreover, we cannot
safely drop the ref while the dvp is locked.

So:
- Use a flag variable to indicate whether the ref is dropped.
- Reorganize things to handle the leak.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: mjg, kib
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39189
sys/fs/fdescfs/fdesc_vnops.c