Source-Changes-HG archive

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

[src/trunk]: src/sys l2tp(4): fix mbuf leak when tunnel nested over the limit



details:   https://anonhg.NetBSD.org/src/rev/3c59e6fe56c4
branches:  trunk
changeset: 355052:3c59e6fe56c4
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue Jul 11 05:03:45 2017 +0000

description:
l2tp(4): fix mbuf leak when tunnel nested over the limit

XXX need pullup -8 branch

diffstat:

 sys/netinet/in_l2tp.c   |  8 +++++---
 sys/netinet6/in6_l2tp.c |  8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 4500119bfca9 -r 3c59e6fe56c4 sys/netinet/in_l2tp.c
--- a/sys/netinet/in_l2tp.c     Tue Jul 11 04:55:39 2017 +0000
+++ b/sys/netinet/in_l2tp.c     Tue Jul 11 05:03:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_l2tp.c,v 1.2 2017/03/30 23:13:54 knakahara Exp $    */
+/*     $NetBSD: in_l2tp.c,v 1.3 2017/07/11 05:03:45 knakahara 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 2017/03/30 23:13:54 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.3 2017/07/11 05:03:45 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -108,8 +108,10 @@
 
        ifp = &sc->l2tp_ec.ec_if;
        error = l2tp_check_nesting(ifp, m);
-       if (error)
+       if (error) {
+               m_freem(m);
                goto looped;
+       }
 
 #ifdef NETYET
 /* TODO: support ALTQ for innner frame */
diff -r 4500119bfca9 -r 3c59e6fe56c4 sys/netinet6/in6_l2tp.c
--- a/sys/netinet6/in6_l2tp.c   Tue Jul 11 04:55:39 2017 +0000
+++ b/sys/netinet6/in6_l2tp.c   Tue Jul 11 05:03:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_l2tp.c,v 1.5 2017/04/04 23:49:18 knakahara Exp $   */
+/*     $NetBSD: in6_l2tp.c,v 1.6 2017/07/11 05:03:45 knakahara 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 2017/04/04 23:49:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.6 2017/07/11 05:03:45 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -108,8 +108,10 @@
        sc = var->lv_softc;
        ifp = &sc->l2tp_ec.ec_if;
        error = l2tp_check_nesting(ifp, m);
-       if (error)
+       if (error) {
+               m_freem(m);
                goto looped;
+       }
 
 #ifdef NOTYET
 /* TODO: support ALTQ for innner frame */



Home | Main Index | Thread Index | Old Index