summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2020-03-20 17:13:51 +0000
committercheloha <cheloha@openbsd.org>2020-03-20 17:13:51 +0000
commit77b6b7cbd0addca11a2c6978781c6eaf19c287fc (patch)
treedee7b1ddee77ad9204ae0b1482707b6d271db901 /sys
parentDisable apm(4) on the floppy ramdisk and keep the cd one in sync. (diff)
downloadwireguard-openbsd-77b6b7cbd0addca11a2c6978781c6eaf19c287fc.tar.xz
wireguard-openbsd-77b6b7cbd0addca11a2c6978781c6eaf19c287fc.zip
__thrsleep(2): ensure timeout is set when calling tsleep_nsec(9)
tsleep_nsec(9) will not set a timeout if the nsecs parameter is equal to INFSLP (UINT64_MAX). We need to limit the duration to MAXTSLP (UINT64_MAX - 1) to ensure a timeout is set.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 81f6c14c50e..efb012278b1 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.165 2020/03/20 04:49:17 cheloha Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.166 2020/03/20 17:13:51 cheloha Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -696,7 +696,7 @@ thrsleep(struct proc *p, struct sys___thrsleep_args *v)
}
timespecsub(tsp, &now, tsp);
- nsecs = TIMESPEC_TO_NSEC(tsp);
+ nsecs = MIN(TIMESPEC_TO_NSEC(tsp), MAXTSLP);
}
if (ident == -1) {