Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/c32eac0f22fc
branches:  netbsd-7
changeset: 798476:c32eac0f22fc
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 30 12:18:56 2014 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #166):
        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 84a5bf6cbd1e -r c32eac0f22fc sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c  Thu Oct 30 12:14:36 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c  Thu Oct 30 12:18:56 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $     */
+/*     $NetBSD: netbsd32_compat_50.c,v 1.24.2.1 2014/10/30 12:18:56 martin 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.24 2014/06/24 14:33:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.24.2.1 2014/10/30 12:18:56 martin 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