Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/msdosfs msdosfs_rename(): fix too many vrele()'s of fdvp...



details:   https://anonhg.NetBSD.org/src/rev/51f8df604559
branches:  trunk
changeset: 495291:51f8df604559
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Jul 25 20:56:10 2000 +0000

description:
msdosfs_rename(): fix too many vrele()'s of fdvp in some error cases;
bug and fix found on OpenBSD, though the fix is implemented very
differently here - we avoid changing correct code and only touch
what needs touching

This solves kern/10312 by Martin J. Laubach.

diffstat:

 sys/msdosfs/msdosfs_vnops.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 54d7cb110cf2 -r 51f8df604559 sys/msdosfs/msdosfs_vnops.c
--- a/sys/msdosfs/msdosfs_vnops.c       Tue Jul 25 20:52:27 2000 +0000
+++ b/sys/msdosfs/msdosfs_vnops.c       Tue Jul 25 20:56:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.99 2000/07/22 15:26:12 jdolecek Exp $      */
+/*     $NetBSD: msdosfs_vnops.c,v 1.100 2000/07/25 20:56:10 jdolecek Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -928,6 +928,7 @@
        struct msdosfsmount *pmp;
        struct direntry *dotdotp;
        struct buf *bp;
+       int fdvp_dorele = 0;
 
        pmp = VFSTOMSDOSFS(fdvp->v_mount);
 
@@ -1096,6 +1097,7 @@
                vrele(tdvp);
                return 0;
        }
+       fdvp_dorele = 1;
        xp = VTODE(fvp);
        zp = VTODE(fdvp);
        from_diroffset = zp->de_fndoffset;
@@ -1204,7 +1206,8 @@
        vput(tdvp);
 out:
        ip->de_flag &= ~DE_RENAME;
-       vrele(fdvp);
+       if (fdvp_dorele)
+               vrele(fdvp);
        vrele(fvp);
        return (error);
 



Home | Main Index | Thread Index | Old Index