Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/puffs Fix use after RECLAIM in PUFFS filesystems



details:   https://anonhg.NetBSD.org/src/rev/bb5759be1dac
branches:  trunk
changeset: 445613:bb5759be1dac
user:      manu <manu%NetBSD.org@localhost>
date:      Tue Nov 06 02:39:49 2018 +0000

description:
Fix use after RECLAIM in PUFFS filesystems

>From hannken@

When puffs_cookie2vnode() misses an entry and vrele() it operations
puffs_vnop_reclaim() and puffs_vnop_fsync() get called with a VNON
vnode.

Do not notify the server in this case as the cookie is stale.

diffstat:

 sys/fs/puffs/puffs_vnops.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r a84603a24cfc -r bb5759be1dac sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Mon Nov 05 21:34:33 2018 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Tue Nov 06 02:39:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.212 2018/11/05 02:28:32 manu Exp $   */
+/*     $NetBSD: puffs_vnops.c,v 1.213 2018/11/06 02:39:49 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.212 2018/11/05 02:28:32 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.213 2018/11/06 02:39:49 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -1470,6 +1470,10 @@
                notifyserver = false;
        }
 
+       /* See the comment on top of puffs_vnop_inactive(). */
+       if (vp->v_type == VNON)
+               notifyserver = false;
+
        /*
         * purge info from kernel before issueing FAF, since we
         * don't really know when we'll get around to it after
@@ -1723,6 +1727,11 @@
        pn = VPTOPP(vp);
        KASSERT(pn != NULL);
        pmp = MPTOPUFFSMP(vp->v_mount);
+
+       /* See the comment on top of puffs_vnop_inactive(). */
+       if (vp->v_type == VNON)
+               return 0;
+
        if (ap->a_flags & FSYNC_WAIT) {
                mutex_enter(&pn->pn_sizemtx);
        } else {



Home | Main Index | Thread Index | Old Index