tech-kern archive

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

cache_enter NCHNAMLEN panic in netbsd-6



Hi

cache_enter() used to panic when cnp->cn_namelen > NCHNAMLEN. filesystem
had to check that condition prior cache_enter() call. puffs failed to do
so and therefore had a bug.

In -current, the cnp->cn_namelen > NCHNAMLEN has just been pushed into
cache_enter() and the filsystem-based checks removed. This fixes puffs
in -current, but it remains broken in netbsd-6

I propose just pulling up this change to netbsd-6 in order to avoid an
intrusive change, while fixing puffs. If that does not meet consensus, I
can propose a puffs-only patch for netbsd-6, but it will not be based on
-current sources.

--- vfs_cache.c 12 Jun 2011 03:35:56 -0000      1.88
+++ vfs_cache.c 22 Jul 2012 00:53:18 -0000      1.89
@@ -586,14 +590,13 @@
        struct namecache *oncp;
        struct nchashhead *ncpp;
        struct ncvhashhead *nvcpp;
 
-#ifdef DIAGNOSTIC
-       if (cnp->cn_namelen > NCHNAMLEN)
-               panic("cache_enter: name too long");
-#endif
-       if (!doingcache)
+       /* First, check whether we can/should add a cache entry. */
+       if ((cnp->cn_flags & MAKEENTRY) == 0 ||
+           __predict_false(cnp->cn_namelen > NCHNAMLEN || !doingcache))
{
                return;
+       }
 
        if (numcache > desiredvnodes) {
                mutex_enter(namecache_lock);
                cache_ev_forced.ev_count++;

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index