Source-Changes-HG archive

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

[src/trunk]: src/sys/net fix l2tp panic when l2tp session id is changed (same...



details:   https://anonhg.NetBSD.org/src/rev/e3746f25e8f8
branches:  trunk
changeset: 356890:e3746f25e8f8
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Oct 19 11:28:30 2017 +0000

description:
fix l2tp panic when l2tp session id is changed (same as if_vlan.c:r1.104)

E.g. the following operation causes this panic.
    ====================
    # ifconfig l2tp0 create
    # ifconfig l2tp0 session 140 140
    # ifconfig l2tp1 create
    # ifconfig l2tp1 session 200 200
    # ifconfig l2tp1 session 300 300
    panic: kernel diagnostic assertion "new->ple_next == NULL" failed: file "/disk4/home/k-nakahara/repos/netbsd-src/sys/sys/pslist.h", line 118
    ====================

Pointed out by s-yamaguchi@IIJ, thanks.

XXX need pullup-8

diffstat:

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

diffs (34 lines):

diff -r 6a15d2f430b6 -r e3746f25e8f8 sys/net/if_l2tp.c
--- a/sys/net/if_l2tp.c Thu Oct 19 10:01:09 2017 +0000
+++ b/sys/net/if_l2tp.c Thu Oct 19 11:28:30 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_l2tp.c,v 1.11 2017/06/01 02:45:14 chs Exp $ */
+/*     $NetBSD: if_l2tp.c,v 1.12 2017/10/19 11:28:30 knakahara Exp $   */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11 2017/06/01 02:45:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.12 2017/10/19 11:28:30 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1069,6 +1069,7 @@
                pserialize_perform(l2tp_psz);
        }
        mutex_exit(&l2tp_hash.lock);
+       PSLIST_ENTRY_DESTROY(sc, l2tp_hash);
 
        l2tp_variant_update(sc, nvar);
        mutex_exit(&sc->l2tp_lock);
@@ -1078,6 +1079,7 @@
                log(LOG_DEBUG, "%s: add hash entry: sess_id=%" PRIu32 ", idx=%" PRIu32 "\n",
                    sc->l2tp_ec.ec_if.if_xname, nvar->lv_my_sess_id, idx);
 
+       PSLIST_ENTRY_INIT(sc, l2tp_hash);
        mutex_enter(&l2tp_hash.lock);
        PSLIST_WRITER_INSERT_HEAD(&l2tp_hash.lists[idx], sc, l2tp_hash);
        mutex_exit(&l2tp_hash.lock);



Home | Main Index | Thread Index | Old Index