Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/cbc1c869639d
branches:  netbsd-8
changeset: 434523:cbc1c869639d
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Jan 02 10:39:57 2018 +0000

description:
Pull up following revision(s) (requested by knakahara in ticket #461):
        sys/netinet/in_l2tp.c: revision 1.9
        sys/netinet6/in6_l2tp.c: revision 1.12
fix mbuf leaks. pointed out and suggested by kre@n.o, thanks.

diffstat:

 sys/netinet/in_l2tp.c   |  16 +++++++---------
 sys/netinet6/in6_l2tp.c |  16 +++++++---------
 2 files changed, 14 insertions(+), 18 deletions(-)

diffs (74 lines):

diff -r ec29881694f8 -r cbc1c869639d sys/netinet/in_l2tp.c
--- a/sys/netinet/in_l2tp.c     Tue Jan 02 10:38:36 2018 +0000
+++ b/sys/netinet/in_l2tp.c     Tue Jan 02 10:39:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_l2tp.c,v 1.2.8.2 2017/12/10 09:41:31 snj Exp $      */
+/*     $NetBSD: in_l2tp.c,v 1.2.8.3 2018/01/02 10:39:57 snj Exp $      */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.2 2017/12/10 09:41:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.3 2018/01/02 10:39:57 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -368,13 +368,11 @@
 
        KASSERT(proto == IPPROTO_L2TP);
 
-       if (m->m_len < off + sizeof(uint32_t)) {
-               m = m_pullup(m, off + sizeof(uint32_t));
-               if (!m) {
-                       /* if payload length < 4 octets */
-                       return 0;
-               }
-        }
+       /*
+        * If the packet contains no session ID it cannot match
+        */
+       if (m_length(m) < off + sizeof(uint32_t))
+               return 0;
 
        /* get L2TP session ID */
        m_copydata(m, off, sizeof(uint32_t), (void *)&sess_id);
diff -r ec29881694f8 -r cbc1c869639d sys/netinet6/in6_l2tp.c
--- a/sys/netinet6/in6_l2tp.c   Tue Jan 02 10:38:36 2018 +0000
+++ b/sys/netinet6/in6_l2tp.c   Tue Jan 02 10:39:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_l2tp.c,v 1.5.8.2 2017/12/10 09:41:32 snj Exp $     */
+/*     $NetBSD: in6_l2tp.c,v 1.5.8.3 2018/01/02 10:39:57 snj Exp $     */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.5.8.2 2017/12/10 09:41:32 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.5.8.3 2018/01/02 10:39:57 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -360,13 +360,11 @@
 
        KASSERT(proto == IPPROTO_L2TP);
 
-       if (m->m_len < off + sizeof(uint32_t)) {
-               m = m_pullup(m, off + sizeof(uint32_t));
-               if (!m) {
-                       /* if payload length < 4 octets */
-                       return 0;
-               }
-        }
+       /*
+        * If the packet contains no session ID it cannot match
+        */
+       if (m_length(m) < off + sizeof(uint32_t))
+               return 0;
 
        /* get L2TP session ID */
        m_copydata(m, off, sizeof(uint32_t), (void *)&sess_id);



Home | Main Index | Thread Index | Old Index