Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/compat/netbsd32 Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/e525b1841a63
branches:  netbsd-6
changeset: 776779:e525b1841a63
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sun Nov 09 07:09:17 2014 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1179):
        sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.

diffstat:

 sys/compat/netbsd32/netbsd32_compat_50.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r bbd42c36769a -r e525b1841a63 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c  Sun Nov 09 07:02:57 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c  Sun Nov 09 07:09:17 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_50.c,v 1.20.6.1 2014/06/30 12:09:40 msaitoh Exp $      */
+/*     $NetBSD: netbsd32_compat_50.c,v 1.20.6.2 2014/11/09 07:09:17 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.20.6.1 2014/06/30 12:09:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.20.6.2 2014/11/09 07:09:17 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -248,30 +248,31 @@
                return (error);
 
        if (SCARG_P32(uap, olddelta)) {
+               mutex_spin_enter(&timecounter_lock);
                atv.tv_sec = time_adjtime / 1000000;
                atv.tv_usec = time_adjtime % 1000000;
                if (atv.tv_usec < 0) {
                        atv.tv_usec += 1000000;
                        atv.tv_sec--;
                }
-               (void) copyout(&atv,
-                              SCARG_P32(uap, olddelta), 
-                              sizeof(atv));
+               mutex_spin_exit(&timecounter_lock);
+
+               error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv));
                if (error)
                        return (error);
        }
        
        if (SCARG_P32(uap, delta)) {
-               error = copyin(SCARG_P32(uap, delta), &atv,
-                              sizeof(struct timeval));
+               error = copyin(SCARG_P32(uap, delta), &atv, sizeof(atv));
                if (error)
                        return (error);
 
+               mutex_spin_enter(&timecounter_lock);
                time_adjtime = (int64_t)atv.tv_sec * 1000000 + atv.tv_usec;
-
                if (time_adjtime)
                        /* We need to save the system time during shutdown */
                        time_adjusted |= 1;
+               mutex_spin_exit(&timecounter_lock);
        }
 
        return 0;



Home | Main Index | Thread Index | Old Index