Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/5261f2035f02
branches:  netbsd-8
changeset: 852429:5261f2035f02
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jul 15 08:20:57 2019 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1288):

        sys/netinet6/udp6_usrreq.c: revision 1.147

Fix the order in udp6_attach: soreserve should be called before
in6_pcballoc, otherwise if it fails there is still a PCB attached, and
we hit a KASSERT in socreate. In !DIAGNOSTIC this would have caused a
memory leak.

By the way I find the splsoftnet highly suspicious, in6_pcballoc already
does that.

diffstat:

 sys/netinet6/udp6_usrreq.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 2b211e0604aa -r 5261f2035f02 sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c        Mon Jul 15 08:18:50 2019 +0000
+++ b/sys/netinet6/udp6_usrreq.c        Mon Jul 15 08:20:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp6_usrreq.c,v 1.129.4.2 2019/01/29 07:04:09 msaitoh Exp $    */
+/*     $NetBSD: udp6_usrreq.c,v 1.129.4.3 2019/07/15 08:20:57 martin Exp $     */
 /*     $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $    */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.129.4.2 2019/01/29 07:04:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.129.4.3 2019/07/15 08:20:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -665,6 +665,11 @@
        KASSERT(sotoin6pcb(so) == NULL);
        sosetlock(so);
 
+       error = soreserve(so, udp6_sendspace, udp6_recvspace);
+       if (error) {
+               return error;
+       }
+
        /*
         * MAPPED_ADDR implementation spec:
         *  Always attach for IPv6, and only when necessary for IPv4.
@@ -675,10 +680,7 @@
        if (error) {
                return error;
        }
-       error = soreserve(so, udp6_sendspace, udp6_recvspace);
-       if (error) {
-               return error;
-       }
+
        in6p = sotoin6pcb(so);
        in6p->in6p_cksum = -1;  /* just to be sure */
 



Home | Main Index | Thread Index | Old Index