devip: increment in counter *AFTER* acquiering the ifc lock or loopbackmedium

This commit is contained in:
cinap_lenrek 2018-04-22 18:50:11 +02:00
parent dbf13129a7
commit 8962551055
2 changed files with 2 additions and 3 deletions

View file

@ -75,14 +75,13 @@ loopbackread(void *a)
lb = ifc->arg; lb = ifc->arg;
lb->readp = up; /* hide identity under a rock for unbind */ lb->readp = up; /* hide identity under a rock for unbind */
if(waserror()){ if(waserror()){
lb->readp = 0; lb->readp = nil;
pexit("hangup", 1); pexit("hangup", 1);
} }
for(;;){ for(;;){
bp = qbread(lb->q, Maxtu); bp = qbread(lb->q, Maxtu);
if(bp == nil) if(bp == nil)
continue; continue;
ifc->in++;
if(!canrlock(ifc)){ if(!canrlock(ifc)){
freeb(bp); freeb(bp);
continue; continue;
@ -91,6 +90,7 @@ loopbackread(void *a)
runlock(ifc); runlock(ifc);
nexterror(); nexterror();
} }
ifc->in++;
if(ifc->lifc == nil) if(ifc->lifc == nil)
freeb(bp); freeb(bp);
else else

View file

@ -117,7 +117,6 @@ netdevread(void *a)
/* /*
* get here if mchan is a pipe and other side hangs up * get here if mchan is a pipe and other side hangs up
* clean up this interface & get out * clean up this interface & get out
ZZZ is this a good idea?
*/ */
poperror(); poperror();
er->readp = nil; er->readp = nil;