Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by msait...



details:   https://anonhg.NetBSD.org/src/rev/2d5668c10e58
branches:  netbsd-8
changeset: 936067:2d5668c10e58
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jul 17 15:28:07 2020 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1576):

        sys/net/if.c: revision 1.479
        sys/compat/common/uipc_syscalls_40.c: revision 1.23
        sys/compat/linux/common/linux_socket.c: revision 1.150
        sys/compat/linux32/common/linux32_socket.c: revision 1.31

 Don't accept negative value.

diffstat:

 sys/compat/common/uipc_syscalls_40.c       |  9 ++++++---
 sys/compat/linux/common/linux_socket.c     |  9 ++++++---
 sys/compat/linux32/common/linux32_socket.c |  9 ++++++---
 sys/net/if.c                               |  9 ++++++---
 4 files changed, 24 insertions(+), 12 deletions(-)

diffs (135 lines):

diff -r 3d6f24b623ec -r 2d5668c10e58 sys/compat/common/uipc_syscalls_40.c
--- a/sys/compat/common/uipc_syscalls_40.c      Wed Jul 15 15:55:49 2020 +0000
+++ b/sys/compat/common/uipc_syscalls_40.c      Fri Jul 17 15:28:07 2020 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: uipc_syscalls_40.c,v 1.13.6.3 2019/04/19 09:12:58 martin Exp $ */
+/*     $NetBSD: uipc_syscalls_40.c,v 1.13.6.4 2020/07/17 15:28:07 martin Exp $ */
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.3 2019/04/19 09:12:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.4 2020/07/17 15:28:07 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -42,11 +42,14 @@
        int bound;
        struct psref psref;
 
-       memset(&ifr, 0, sizeof(ifr));
        if (docopy) {
+               if (ifc->ifc_len < 0)
+                       return EINVAL;
+
                space = ifc->ifc_len;
                ifrp = ifc->ifc_req;
        }
+       memset(&ifr, 0, sizeof(ifr));
 
        bound = curlwp_bind();
        s = pserialize_read_enter();
diff -r 3d6f24b623ec -r 2d5668c10e58 sys/compat/linux/common/linux_socket.c
--- a/sys/compat/linux/common/linux_socket.c    Wed Jul 15 15:55:49 2020 +0000
+++ b/sys/compat/linux/common/linux_socket.c    Fri Jul 17 15:28:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_socket.c,v 1.138.6.5 2020/01/21 18:12:54 martin Exp $    */
+/*     $NetBSD: linux_socket.c,v 1.138.6.6 2020/07/17 15:28:08 martin Exp $    */
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.5 2020/01/21 18:12:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.6 2020/07/17 15:28:08 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1156,12 +1156,15 @@
        if (error)
                return error;
 
-       memset(&ifr, 0, sizeof(ifr));
        docopy = ifc.ifc_req != NULL;
        if (docopy) {
+               if (ifc.ifc_len < 0)
+                       return EINVAL;
+
                space = ifc.ifc_len;
                ifrp = ifc.ifc_req;
        }
+       memset(&ifr, 0, sizeof(ifr));
 
        bound = curlwp_bind();
        s = pserialize_read_enter();
diff -r 3d6f24b623ec -r 2d5668c10e58 sys/compat/linux32/common/linux32_socket.c
--- a/sys/compat/linux32/common/linux32_socket.c        Wed Jul 15 15:55:49 2020 +0000
+++ b/sys/compat/linux32/common/linux32_socket.c        Fri Jul 17 15:28:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux32_socket.c,v 1.27.6.3 2019/04/19 09:12:58 martin Exp $ */
+/*     $NetBSD: linux32_socket.c,v 1.27.6.4 2020/07/17 15:28:08 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.27.6.3 2019/04/19 09:12:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.27.6.4 2020/07/17 15:28:08 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -431,12 +431,15 @@
        if (error)
                return error;
 
-       memset(&ifr, 0, sizeof(ifr));
        docopy = NETBSD32PTR64(ifc.ifc_req) != NULL;
        if (docopy) {
+               if (ifc.ifc_len < 0)
+                       return EINVAL;
+
                space = ifc.ifc_len;
                ifrp = NETBSD32PTR64(ifc.ifc_req);
        }
+       memset(&ifr, 0, sizeof(ifr));
 
        bound = curlwp_bind();
        s = pserialize_read_enter();
diff -r 3d6f24b623ec -r 2d5668c10e58 sys/net/if.c
--- a/sys/net/if.c      Wed Jul 15 15:55:49 2020 +0000
+++ b/sys/net/if.c      Fri Jul 17 15:28:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.394.2.18 2019/09/24 18:27:09 martin Exp $     */
+/*     $NetBSD: if.c,v 1.394.2.19 2020/07/17 15:28:07 martin Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.18 2019/09/24 18:27:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.19 2020/07/17 15:28:07 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3392,11 +3392,14 @@
        int bound;
        struct psref psref;
 
-       memset(&ifr, 0, sizeof(ifr));
        if (docopy) {
+               if (ifc->ifc_len < 0)
+                       return EINVAL;
+
                space = ifc->ifc_len;
                ifrp = ifc->ifc_req;
        }
+       memset(&ifr, 0, sizeof(ifr));
 
        bound = curlwp_bind();
        s = pserialize_read_enter();



Home | Main Index | Thread Index | Old Index