Module Name:    src
Committed By:   chs
Date:           Mon Feb 27 16:10:56 UTC 2012

Modified Files:
        src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
in tmpfs_readdir(), skip the . and .. processing on removed directories,
since the latter will crash in this case.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/fs/tmpfs/tmpfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.94 src/sys/fs/tmpfs/tmpfs_vnops.c:1.95
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.94	Sun Jan 22 03:13:19 2012
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Mon Feb 27 16:10:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.94 2012/01/22 03:13:19 rmind Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.95 2012/02/27 16:10:56 chs 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.94 2012/01/22 03:13:19 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.95 2012/02/27 16:10:56 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -2206,6 +2206,10 @@ tmpfs_readdir(void *v)
 	node = VP_TO_TMPFS_DIR(vp);
 	startoff = uio->uio_offset;
 	cnt = 0;
+	if (node->tn_links == 0) {
+		error = 0;
+		goto out;
+	}
 
 	if (uio->uio_offset == TMPFS_DIRCOOKIE_DOT) {
 		error = tmpfs_dir_getdotdent(node, uio);

Reply via email to