Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add softnet_lock to if_link_state_change_si



details:   https://anonhg.NetBSD.org/src/rev/27e4555ff82b
branches:  trunk
changeset: 820460:27e4555ff82b
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jan 10 08:45:45 2017 +0000

description:
Add softnet_lock to if_link_state_change_si

Fix
  panic: lock error: Mutex: mutex_vector_exit: assertion failed:
  MUTEX_OWNER(mtx->mtx_owner) == curthread
at callout_halt <= arp_dad_stop <= in_if_link_down.

diffstat:

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

diffs (40 lines):

diff -r c523e53378ca -r 27e4555ff82b sys/net/if.c
--- a/sys/net/if.c      Tue Jan 10 08:40:27 2017 +0000
+++ b/sys/net/if.c      Tue Jan 10 08:45:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.370 2017/01/10 05:42:34 ozaki-r Exp $ */
+/*     $NetBSD: if.c,v 1.371 2017/01/10 08:45:45 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.370 2017/01/10 05:42:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.371 2017/01/10 08:45:45 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2272,6 +2272,10 @@
        int s;
        uint8_t state;
 
+#ifndef NET_MPSAFE
+       mutex_enter(softnet_lock);
+       KERNEL_LOCK(1, NULL);
+#endif
        s = splnet();
 
        /* Pop a link state change from the queue and process it. */
@@ -2283,6 +2287,10 @@
                softint_schedule(ifp->if_link_si);
 
        splx(s);
+#ifndef NET_MPSAFE
+       KERNEL_UNLOCK_ONE(NULL);
+       mutex_exit(softnet_lock);
+#endif
 }
 
 /*



Home | Main Index | Thread Index | Old Index