On Thu, Jan 05, 2017 at 10:38:00PM +0100, Alexander Bluhm wrote:
> Manual inspection shows that the last function is used in a timeout.
> timeout_set(&keepalive_ch, sppp_keepalive, NULL);

Of course we need a process context to call NET_LOCK().  New diff.

bluhm

Index: net/if_spppsubr.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_spppsubr.c,v
retrieving revision 1.158
diff -u -p -r1.158 if_spppsubr.c
--- net/if_spppsubr.c   2 Jan 2017 08:41:21 -0000       1.158
+++ net/if_spppsubr.c   5 Jan 2017 21:42:00 -0000
@@ -693,7 +693,7 @@ sppp_attach(struct ifnet *ifp)
 
        /* Initialize keepalive handler. */
        if (! spppq) {
-               timeout_set(&keepalive_ch, sppp_keepalive, NULL);
+               timeout_set_proc(&keepalive_ch, sppp_keepalive, NULL);
                timeout_add_sec(&keepalive_ch, 10);
        }
 
@@ -4050,9 +4050,10 @@ void
 sppp_keepalive(void *dummy)
 {
        struct sppp *sp;
-       int s;
+       int s, sl;
        struct timeval tv;
 
+       NET_LOCK(sl);
        s = splnet();
        getmicrouptime(&tv);
        for (sp=spppq; sp; sp=sp->pp_next) {
@@ -4104,6 +4105,7 @@ sppp_keepalive(void *dummy)
                }
        }
        splx(s);
+       NET_UNLOCK(sl);
        timeout_add_sec(&keepalive_ch, 10);
 }
 

Reply via email to