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.
This commit is contained in:
jmmv 2009-11-22 17:09:58 +00:00
parent c88ba29086
commit df61ab1eba
1 changed files with 6 additions and 3 deletions

View File

@ -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 @@ out:
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;
}