Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/puffs Di not call cache_enter with path components bi...



details:   https://anonhg.NetBSD.org/src/rev/9a3daf48f07c
branches:  trunk
changeset: 780431:9a3daf48f07c
user:      manu <manu%NetBSD.org@localhost>
date:      Mon Jul 23 12:15:30 2012 +0000

description:
Di not call cache_enter with path components bigger than NCHNAMLEN, as it
panics the kernel.

diffstat:

 sys/fs/puffs/puffs_node.c  |  6 +++---
 sys/fs/puffs/puffs_vnops.c |  9 +++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r b4fd55c8a516 -r 9a3daf48f07c sys/fs/puffs/puffs_node.c
--- a/sys/fs/puffs/puffs_node.c Mon Jul 23 07:47:40 2012 +0000
+++ b/sys/fs/puffs/puffs_node.c Mon Jul 23 12:15:30 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_node.c,v 1.25 2012/07/22 00:53:20 rmind Exp $    */
+/*     $NetBSD: puffs_node.c,v 1.26 2012/07/23 12:15:30 manu Exp $     */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.25 2012/07/22 00:53:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.26 2012/07/23 12:15:30 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/hash.h>
@@ -246,7 +246,7 @@
        vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        *vpp = vp;
 
-       if (PUFFS_USE_NAMECACHE(pmp))
+       if (PUFFS_USE_NAMECACHE(pmp) && (cnp->cn_namelen <= NCHNAMLEN))
                cache_enter(dvp, vp, cnp);
 
        return 0;
diff -r b4fd55c8a516 -r 9a3daf48f07c sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Mon Jul 23 07:47:40 2012 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Mon Jul 23 12:15:30 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.168 2012/07/22 00:53:20 rmind Exp $  */
+/*     $NetBSD: puffs_vnops.c,v 1.169 2012/07/23 12:15:30 manu Exp $   */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.168 2012/07/22 00:53:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.169 2012/07/23 12:15:30 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -587,7 +587,8 @@
                        /* save negative cache entry */
                        } else {
                                if (PUFFS_USE_NAMECACHE(pmp) &&
-                                   !PUFFS_USE_FS_TTL(pmp))
+                                   !PUFFS_USE_FS_TTL(pmp) &&
+                                   (cnp->cn_namelen <= NCHNAMLEN))
                                        cache_enter(dvp, NULL, cnp);
                        }
                }
@@ -663,7 +664,7 @@
        KASSERT(lookup_msg->pvnr_newnode == VPTOPP(vp)->pn_cookie);
        *ap->a_vpp = vp;
 
-       if (PUFFS_USE_NAMECACHE(pmp))
+       if (PUFFS_USE_NAMECACHE(pmp) && (cnp->cn_namelen <= NCHNAMLEN))
                cache_enter(dvp, vp, cnp);
 
        /* XXX */



Home | Main Index | Thread Index | Old Index