Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Merge -r1.44 of ufs_extattr.c and related change...



details:   https://anonhg.NetBSD.org/src/rev/65d02fb9249a
branches:  trunk
changeset: 816153:65d02fb9249a
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Jun 20 01:44:05 2016 +0000

description:
Merge -r1.44 of ufs_extattr.c and related change -r1.302 of ffs_vfops.c:
fix use-after-free on failed unmount with extended attributes enabled.

diffstat:

 sys/ufs/lfs/lfs_vfsops.c   |  17 +++--------------
 sys/ufs/lfs/ulfs_extattr.c |  12 ++++++++----
 2 files changed, 11 insertions(+), 18 deletions(-)

diffs (88 lines):

diff -r 5a516af17f83 -r 65d02fb9249a sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Mon Jun 20 01:23:04 2016 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Mon Jun 20 01:44:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.349 2015/10/19 04:22:18 dholland Exp $        */
+/*     $NetBSD: lfs_vfsops.c,v 1.350 2016/06/20 01:44:05 dholland Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.349 2015/10/19 04:22:18 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.350 2016/06/20 01:44:05 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -1248,18 +1248,6 @@
                }
        }
 
-#ifdef LFS_EXTATTR
-       /*
-        * Initialize file-backed extended attributes for ULFS1 file
-        * systems.
-        *
-        * XXX: why is this limited to ULFS1?
-        */
-       if (ump->um_fstype == ULFS1) {
-               ulfs_extattr_uepm_init(&ump->um_extattr);
-       }
-#endif
-
 #ifdef LFS_KERNEL_RFW
        lfs_roll_forward(fs, mp, l);
 #endif
@@ -1372,6 +1360,7 @@
                }
                if (ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_INITIALIZED) {
                        ulfs_extattr_uepm_destroy(&ump->um_extattr);
+                       mp->mnt_flag &= ~MNT_EXTATTR;
                }
        }
 #endif
diff -r 5a516af17f83 -r 65d02fb9249a sys/ufs/lfs/ulfs_extattr.c
--- a/sys/ufs/lfs/ulfs_extattr.c        Mon Jun 20 01:23:04 2016 +0000
+++ b/sys/ufs/lfs/ulfs_extattr.c        Mon Jun 20 01:44:05 2016 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ulfs_extattr.c,v 1.9 2016/06/20 00:00:47 dholland Exp $        */
-/*  from NetBSD: ufs_extattr.c,v 1.43 2014/02/07 15:29:23 hannken Exp  */
+/*     $NetBSD: ulfs_extattr.c,v 1.10 2016/06/20 01:44:05 dholland Exp $       */
+/*  from NetBSD: ufs_extattr.c,v 1.44 2014/11/14 10:09:50 manu  */
 
 /*-
  * Copyright (c) 1999-2002 Robert N. M. Watson
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_extattr.c,v 1.9 2016/06/20 00:00:47 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_extattr.c,v 1.10 2016/06/20 01:44:05 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lfs.h"
@@ -384,10 +384,11 @@
                panic("ulfs_extattr_uepm_destroy: called while still started");
 
        /*
-        * It's not clear that either order for the next two lines is
+        * It's not clear that either order for the next three lines is
         * ideal, and it should never be a problem if this is only called
         * during unmount, and with vfs_busy().
         */
+       uepm->uepm_flags &= ~ULFS_EXTATTR_UEPM_STARTED;
        uepm->uepm_flags &= ~ULFS_EXTATTR_UEPM_INITIALIZED;
        mutex_destroy(&uepm->uepm_lock);
 }
@@ -403,6 +404,9 @@
 
        ump = VFSTOULFS(mp);
 
+       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_INITIALIZED))
+               ulfs_extattr_uepm_init(&ump->um_extattr); 
+
        ulfs_extattr_uepm_lock(ump);
 
        if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_INITIALIZED)) {



Home | Main Index | Thread Index | Old Index