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

(cherry picked from commit b8073b3c74)
This commit is contained in:
Edward Tomasz Napierala 2021-01-31 21:37:41 +00:00
parent e681d7d702
commit f6082ba9d2

View file

@ -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);