Hi,
My static code analysis has found a missing netlock. Starting from
a given function it finds reverse traces that have no NET_LOCK().
Lock not found: [CGNode: if_linkstate, CGNode: if_down, CGNode: sppp_keepalive]
Manual inspection shows that the last function is used in a timeout.
timeout_set(&keepalive_ch, sppp_keepalive, NULL);
ok?
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:34:39 -0000
@@ -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);
}