On 23/12/16(Fri) 06:08, Visa Hankala wrote:
> NET_LOCK() should raise IPL before acquiring the lock, and NET_UNLOCK()
> should restore the level after releasing the lock. Otherwise, lock
> recursion can occur, most likely right after the splx(). An example:
> 
> nd6_slowtimo  <- NET_LOCK()
> timeout_run
> softclock
> softintr_dispatch
> dosoftint
> interrupt
> k_intr
> if_netisr  <- NET_LOCK()
> taskq_thread
> 
> OK?

This should never happen.  Simply because the NET_LOCK() MUST NOT be
taken in (soft) interrupt context.

The real problem is that nd6_slowtimo() is set twice, once with
timeout_set_proc(9) and once with timeout_set(9).  Diff below fixes
that.

ok?

Index: netinet6/nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.200
diff -u -p -r1.200 nd6.c
--- netinet6/nd6.c      22 Dec 2016 13:39:32 -0000      1.200
+++ netinet6/nd6.c      23 Dec 2016 10:37:33 -0000
@@ -1479,7 +1479,6 @@ nd6_slowtimo(void *ignored_arg)
 
        NET_LOCK(s);
 
-       timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL);
        timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
 
        TAILQ_FOREACH(ifp, &ifnet, if_list) {

Reply via email to