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.46 of ufs_extattr.c: Fix uninitialized...



details:   https://anonhg.NetBSD.org/src/rev/f4b9e43f69f8
branches:  trunk
changeset: 816155:f4b9e43f69f8
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Jun 20 01:50:13 2016 +0000

description:
Merge -r1.46 of ufs_extattr.c: Fix uninitialized mutex usage

diffstat:

 sys/ufs/lfs/ulfs_extattr.c |  38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diffs (116 lines):

diff -r 4a1b0bc740ef -r f4b9e43f69f8 sys/ufs/lfs/ulfs_extattr.c
--- a/sys/ufs/lfs/ulfs_extattr.c        Mon Jun 20 01:47:58 2016 +0000
+++ b/sys/ufs/lfs/ulfs_extattr.c        Mon Jun 20 01:50:13 2016 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ulfs_extattr.c,v 1.11 2016/06/20 01:47:58 dholland Exp $       */
-/*  from NetBSD: ufs_extattr.c,v 1.45 2014/11/15 05:03:55 manu Exp  */
+/*     $NetBSD: ulfs_extattr.c,v 1.12 2016/06/20 01:50:13 dholland Exp $       */
+/*  from NetBSD: ufs_extattr.c,v 1.46 2014/11/19 16:26:47 manu Exp  */
 
 /*-
  * 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.11 2016/06/20 01:47:58 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_extattr.c,v 1.12 2016/06/20 01:50:13 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lfs.h"
@@ -1103,6 +1103,9 @@
        struct ulfsmount *ump = VFSTOULFS(mp);
        int error;
 
+       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
+               return (EOPNOTSUPP);
+
        ulfs_extattr_uepm_lock(ump);
 
        error = ulfs_extattr_get(ap->a_vp, ap->a_attrnamespace, ap->a_name,
@@ -1129,9 +1132,6 @@
        size_t len, old_len;
        int error = 0;
 
-       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
-               return (EOPNOTSUPP);
-
        if (strlen(name) == 0)
                return (EINVAL);
 
@@ -1221,6 +1221,9 @@
        struct ulfsmount *ump = VFSTOULFS(mp);
        int error;
 
+       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
+               return (EOPNOTSUPP);
+
        ulfs_extattr_uepm_lock(ump);
 
        error = ulfs_extattr_list(ap->a_vp, ap->a_attrnamespace,
@@ -1247,9 +1250,6 @@
        size_t listsize = 0;
        int error = 0;
 
-       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
-               return (EOPNOTSUPP);
-
        /*
         * XXX: We can move this inside the loop and iterate on individual
         *      attributes.
@@ -1348,6 +1348,9 @@
        struct ulfsmount *ump = VFSTOULFS(mp); 
        int error;
 
+       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
+               return (EOPNOTSUPP);
+
        ulfs_extattr_uepm_lock(ump);
 
        error = ulfs_extattr_rm(ap->a_vp, ap->a_attrnamespace, ap->a_name,
@@ -1377,6 +1380,9 @@
        struct ulfsmount *ump = VFSTOULFS(mp); 
        int error;
 
+       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
+               return (EOPNOTSUPP);
+
        ulfs_extattr_uepm_lock(ump);
 
        /*
@@ -1415,8 +1421,7 @@
 
        if (vp->v_mount->mnt_flag & MNT_RDONLY)
                return (EROFS);
-       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
-               return (EOPNOTSUPP);
+
        if (!ulfs_extattr_valid_attrname(attrnamespace, name))
                return (EINVAL);
 
@@ -1535,8 +1540,7 @@
 
        if (vp->v_mount->mnt_flag & MNT_RDONLY)  
                return (EROFS);
-       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
-               return (EOPNOTSUPP);
+
        if (!ulfs_extattr_valid_attrname(attrnamespace, name))
                return (EINVAL);
 
@@ -1609,12 +1613,10 @@
        if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_INITIALIZED))
                return;
 
-       ulfs_extattr_uepm_lock(ump);
+       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED))
+               return;
 
-       if (!(ump->um_extattr.uepm_flags & ULFS_EXTATTR_UEPM_STARTED)) {
-               ulfs_extattr_uepm_unlock(ump);
-               return;
-       }
+       ulfs_extattr_uepm_lock(ump);
 
        LIST_FOREACH(uele, &ump->um_extattr.uepm_list, uele_entries)
                ulfs_extattr_rm(vp, uele->uele_attrnamespace,



Home | Main Index | Thread Index | Old Index