Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Mar 2021 18:43:41 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f6082ba9d2e0 - stable/13 - msdosfs: fix vnode leak with msdosfs_rename()
Message-ID:  <202103021843.122Ihfpn018717@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@FreeBSD.org>
AuthorDate: 2021-01-31 21:37:41 +0000
Commit:     Edward Tomasz Napierala <trasz@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103021843.122Ihfpn018717>