Source-Changes-HG archive

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

[src/trunk]: src/sys/net Reinit a pslist entry before inserting it to a pslis...



details:   https://anonhg.NetBSD.org/src/rev/f3ab4c936df2
branches:  trunk
changeset: 821863:f3ab4c936df2
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Feb 20 03:08:38 2017 +0000

description:
Reinit a pslist entry before inserting it to a pslist again

Fix PR kern/51984
Tested by nonaka@

diffstat:

 sys/net/bpf.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 083ec7e3c0dc -r f3ab4c936df2 sys/net/bpf.c
--- a/sys/net/bpf.c     Mon Feb 20 02:56:03 2017 +0000
+++ b/sys/net/bpf.c     Mon Feb 20 03:08:38 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.c,v 1.215 2017/02/19 13:58:42 christos Exp $       */
+/*     $NetBSD: bpf.c,v 1.216 2017/02/20 03:08:38 ozaki-r Exp $        */
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.215 2017/02/19 13:58:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216 2017/02/20 03:08:38 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -1380,11 +1380,13 @@
                }
                mutex_enter(d->bd_mtx);
                if (bp != d->bd_bif) {
-                       if (d->bd_bif)
+                       if (d->bd_bif) {
                                /*
                                 * Detach if attached to something else.
                                 */
                                bpf_detachd(d);
+                               BPFIF_DLIST_ENTRY_INIT(d);
+                       }
 
                        bpf_attachd(d, bp);
                }
@@ -2239,6 +2241,7 @@
                return EINVAL;
        opromisc = d->bd_promisc;
        bpf_detachd(d);
+       BPFIF_DLIST_ENTRY_INIT(d);
        bpf_attachd(d, bp);
        reset_d(d);
        if (opromisc) {



Home | Main Index | Thread Index | Old Index