Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs in tmpfs_readdir(), skip the . and .. processin...



details:   https://anonhg.NetBSD.org/src/rev/5040c26a96b7
branches:  trunk
changeset: 777645:5040c26a96b7
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Feb 27 16:10:56 2012 +0000

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

diffstat:

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

diffs (29 lines):

diff -r aa5249c46459 -r 5040c26a96b7 sys/fs/tmpfs/tmpfs_vnops.c
--- a/sys/fs/tmpfs/tmpfs_vnops.c        Mon Feb 27 15:57:21 2012 +0000
+++ b/sys/fs/tmpfs/tmpfs_vnops.c        Mon Feb 27 16:10:56 2012 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index