Source-Changes-HG archive

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

[src/trunk]: src/sys/kern recvmmsg(2): More timespec validation.



details:   https://anonhg.NetBSD.org/src/rev/c9724bd01e01
branches:  trunk
changeset: 368226:c9724bd01e01
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jun 29 22:27:12 2022 +0000

description:
recvmmsg(2): More timespec validation.

Reported-by: syzbot+004ed2f264534bd27312%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+6f9014c842c4e78df7bc%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/uipc_syscalls.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 9eafe7d90ba2 -r c9724bd01e01 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Wed Jun 29 22:27:01 2022 +0000
+++ b/sys/kern/uipc_syscalls.c  Wed Jun 29 22:27:12 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.204 2022/06/28 11:41:32 riastradh Exp $    */
+/*     $NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.204 2022/06/28 11:41:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -1041,6 +1041,8 @@
        if (SCARG(uap, timeout)) {
                if ((error = copyin(SCARG(uap, timeout), &ts, sizeof(ts))) != 0)
                        return error;
+               if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000L)
+                       return EINVAL;
                getnanotime(&now);
                if (timespecaddok(&now, &ts)) {
                        timespecadd(&now, &ts, &ts);



Home | Main Index | Thread Index | Old Index