Date: Sun, 31 Jan 2021 21:41:02 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b8073b3c7434 - main - msdosfs: fix vnode leak with msdosfs_rename() Message-ID: <202101312141.10VLf2D0021846@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=b8073b3c74342113398f36a1c68f442ae9e092e6 commit b8073b3c74342113398f36a1c68f442ae9e092e6 Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-01-31 21:37:41 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-01-31 21:37:44 +0000 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 --- sys/fs/msdosfs/msdosfs_vnops.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101312141.10VLf2D0021846>