code: plan9front

Download patch

ref: a9cdbcd5016319901ea112096f042ac9017cdce4
parent: 9ebe38c9602310d6c8404e1d8104a744c09f0215
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 19 19:36:32 EDT 2023

devip: rlock ifc before accessing interface parameters in ipifcstate()

--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -258,6 +258,7 @@
 	int m;
 
 	ifc = (Ipifc*)c->ptcl;
+	rlock(ifc);
 	m = snprint(state, n, sfixedformat,
 		ifc->dev, ifc->maxtu, ifc->sendra6, ifc->recvra6,
 		ifc->rp.mflag, ifc->rp.oflag, ifc->rp.maxraint,
@@ -266,7 +267,6 @@
 		ifc->in, ifc->out, ifc->inerr, ifc->outerr,
 		ifc->speed, ifc->delay);
 
-	rlock(ifc);
 	for(lifc = ifc->lifc; lifc != nil && n > m; lifc = lifc->next)
 		m += snprint(state+m, n - m, slineformat, lifc->local,
 			lifc->mask, lifc->remote, lifc->validlt, lifc->preflt);