diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2021-01-31 21:37:41 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2021-01-31 21:37:44 +0000 |
commit | b8073b3c74342113398f36a1c68f442ae9e092e6 (patch) | |
tree | 199711eaea663ab1e7091587e52901826bb366b6 | |
parent | cb696212495995c8374d9fe12fbae340614af45c (diff) |
msdosfs: fix vnode leak with msdosfs_rename()
This could happen when failing due to disappearing source file.
Reviewed By: kib
Tested by: pho
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27338
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index e1e679d92146..8885ac856588 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1122,6 +1122,14 @@ abortit: VOP_UNLOCK(tdvp); vrele(tdvp); vrele(ap->a_fvp); + /* + * fdvp may be locked and has a reference. We need to + * release the lock and reference, unless to and from + * directories are the same. In that case it is already + * unlocked. + */ + if (tdvp != fdvp) + vput(fdvp); return 0; } xp = VTODE(fvp); |