Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 fix multiple mistakes:
details: https://anonhg.NetBSD.org/src/rev/6fad81f598e7
branches: trunk
changeset: 333295:6fad81f598e7
user: christos <christos%NetBSD.org@localhost>
date: Mon Oct 27 19:10:21 2014 +0000
description:
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 cf404600e912 -r 6fad81f598e7 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Mon Oct 27 16:21:59 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Mon Oct 27 19:10:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.27 2014/09/05 09:21:54 matt Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.28 2014/10/27 19:10:21 christos 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.27 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.28 2014/10/27 19:10:21 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -247,30 +247,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