git: f6082ba9d2e0 - stable/13 - msdosfs: fix vnode leak with msdosfs_rename()

Edward Tomasz Napierala trasz at FreeBSD.org
Tue Mar 2 18:43:41 UTC 2021


The branch stable/13 has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=f6082ba9d2e0f3ba3cfcbdfdccdf2315e3698b8d

commit f6082ba9d2e0f3ba3cfcbdfdccdf2315e3698b8d
Author:     Edward Tomasz Napierala <trasz at FreeBSD.org>
AuthorDate: 2021-01-31 21:37:41 +0000
Commit:     Edward Tomasz Napierala <trasz at FreeBSD.org>
CommitDate: 2021-03-02 18:43:26 +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
    
    (cherry picked from commit b8073b3c74342113398f36a1c68f442ae9e092e6)
---
 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);


More information about the dev-commits-src-all mailing list