Source-Changes-HG archive

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

[src/trunk]: src/sys/net Protect if_deferred_start_softint with KERNEL_LOCK i...



details:   https://anonhg.NetBSD.org/src/rev/3c095a571bcc
branches:  trunk
changeset: 322717:3c095a571bcc
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon May 14 02:55:46 2018 +0000

description:
Protect if_deferred_start_softint with KERNEL_LOCK if the interface isn't MP-safe

diffstat:

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

diffs (34 lines):

diff -r 55750fcaca48 -r 3c095a571bcc sys/net/if.c
--- a/sys/net/if.c      Mon May 14 02:55:03 2018 +0000
+++ b/sys/net/if.c      Mon May 14 02:55:46 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.422 2018/05/14 02:55:03 ozaki-r Exp $ */
+/*     $NetBSD: if.c,v 1.423 2018/05/14 02:55:46 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.422 2018/05/14 02:55:03 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.423 2018/05/14 02:55:46 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1055,11 +1055,13 @@
 if_deferred_start_init(struct ifnet *ifp, void (*func)(struct ifnet *))
 {
        struct if_deferred_start *ids;
+       u_int flags = SOFTINT_NET;
+
+       flags |= if_is_mpsafe(ifp) ? SOFTINT_MPSAFE : 0;
 
        ids = kmem_zalloc(sizeof(*ids), KM_SLEEP);
        ids->ids_ifp = ifp;
-       ids->ids_si = softint_establish(SOFTINT_NET|SOFTINT_MPSAFE,
-           if_deferred_start_softint, ids);
+       ids->ids_si = softint_establish(flags, if_deferred_start_softint, ids);
        if (func != NULL)
                ids->ids_if_start = func;
        else



Home | Main Index | Thread Index | Old Index