Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs Fix panic when trying to delete a directory ent...



details:   https://anonhg.NetBSD.org/src/rev/6f54beb27b63
branches:  trunk
changeset: 749231:6f54beb27b63
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Sun Nov 22 17:09:58 2009 +0000

description:
Fix panic when trying to delete a directory entry (hi yamt!) by not
attempting to release a pnbuf that does not exist.

I.e. fixes "mkdir a ; unlink a/.".  And actually, this was caught by the
automated tests.

diffstat:

 sys/fs/tmpfs/tmpfs_vnops.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 0c4d2955e76c -r 6f54beb27b63 sys/fs/tmpfs/tmpfs_vnops.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c        Sun Nov 22 16:50:13 2009 +0000
+++ b/sys/fs/tmpfs/tmpfs_vnops.c        Sun Nov 22 17:09:58 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_vnops.c,v 1.64 2009/10/17 22:20:56 njoly Exp $   */
+/*     $NetBSD: tmpfs_vnops.c,v 1.65 2009/11/22 17:09:58 jmmv Exp $    */
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.64 2009/10/17 22:20:56 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.65 2009/11/22 17:09:58 jmmv Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -728,7 +728,10 @@
                vrele(dvp);
        else
                vput(dvp);
-       PNBUF_PUT(cnp->cn_pnbuf);
+       if (cnp->cn_flags & HASBUF) {
+               PNBUF_PUT(cnp->cn_pnbuf);
+               cnp->cn_flags &= ~HASBUF;
+       }
 
        return error;
 }



Home | Main Index | Thread Index | Old Index