ref: 8fdd633d57778af2e7fc01115e67f3735e553244
parent: 55b73cbbbf687f8ec40273a3780d72bedb37f818
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jun 12 16:31:39 EDT 2018
devip: fix missing wunlock() for "ipifc not yet bound to device" case, don't create multicast entry on error
--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -498,9 +498,10 @@
}
wlock(ifc);
- if(ifc->m == nil)
+ if(ifc->m == nil){
+ wunlock(ifc);
return "ipifc not yet bound to device";
-
+ }
f = ifc->conv->p->f;
if(waserror()){
wunlock(ifc);
@@ -893,7 +894,6 @@
int h;
type |= (lifc->type & Rv4);
-
qlock(f->self);
if(waserror()){
qunlock(f->self);
@@ -1470,11 +1470,6 @@
if(ipcmp(ma, (*l)->ma) == 0 && ipcmp(ia, (*l)->ia) == 0)
return; /* it's already there */
- multi = *l = smalloc(sizeof(*multi));
- ipmove(multi->ma, ma);
- ipmove(multi->ia, ia);
- multi->next = nil;
-
f = c->p->f;
if((ifc = findipifc(f, ia, ma, Rmulti)) != nil){
wlock(ifc);
@@ -1487,6 +1482,12 @@
wunlock(ifc);
poperror();
}
+
+ multi = smalloc(sizeof(*multi));
+ ipmove(multi->ma, ma);
+ ipmove(multi->ia, ia);
+ multi->next = nil;
+ *l = multi;
}