summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-06-12 20:31:39 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2018-06-12 20:31:39 +0200
commit8fdd633d57778af2e7fc01115e67f3735e553244 (patch)
treeac06948d6913a9a6c11a1b89ac4a677ff34cb87e
parent55b73cbbbf687f8ec40273a3780d72bedb37f818 (diff)
downloadplan9front-8fdd633d57778af2e7fc01115e67f3735e553244.tar.xz
devip: fix missing wunlock() for "ipifc not yet bound to device" case, don't create multicast entry on error
-rw-r--r--sys/src/9/ip/ipifc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/src/9/ip/ipifc.c b/sys/src/9/ip/ipifc.c
index 29b82e61a..b2fc1676c 100644
--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -498,9 +498,10 @@ ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp)
}
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 @@ addselfcache(Fs *f, Ipifc *ifc, Iplifc *lifc, uchar *a, int type)
int h;
type |= (lifc->type & Rv4);
-
qlock(f->self);
if(waserror()){
qunlock(f->self);
@@ -1470,11 +1470,6 @@ ipifcaddmulti(Conv *c, uchar *ma, uchar *ia)
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 @@ ipifcaddmulti(Conv *c, uchar *ma, uchar *ia)
wunlock(ifc);
poperror();
}
+
+ multi = smalloc(sizeof(*multi));
+ ipmove(multi->ma, ma);
+ ipmove(multi->ia, ia);
+ multi->next = nil;
+ *l = multi;
}