summaryrefslogtreecommitdiff
path: root/sys/src/9/ip
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-02-21 16:36:41 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-02-21 16:36:41 +0100
commit688c1f15cdaa5fcad19d9fddb30e1c555bfc59e0 (patch)
tree631e6ce76cf1349558915fb0a3375c7087df34e6 /sys/src/9/ip
parent9d30cabbafc28fc0a28bb3716274dc3716e6cc27 (diff)
fix ipv6 icmphostunr() locking and memory free bugs (from sources)
Diffstat (limited to 'sys/src/9/ip')
-rw-r--r--sys/src/9/ip/icmp6.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/src/9/ip/icmp6.c b/sys/src/9/ip/icmp6.c
index 7335a3c5e..75419f918 100644
--- a/sys/src/9/ip/icmp6.c
+++ b/sys/src/9/ip/icmp6.c
@@ -432,23 +432,19 @@ icmphostunr(Fs *f, Ipifc *ifc, Block *bp, int code, int free)
p = (Ip6hdr *)bp->rp;
if(isv6mcast(p->src))
- goto clean;
+ goto freebl;
nbp = newIPICMP(sz);
np = (IPICMP *)nbp->rp;
rlock(ifc);
if(ipv6anylocal(ifc, np->src))
- netlog(f, Logicmp, "send icmphostunr -> src %I dst %I\n",
- p->src, p->dst);
+ netlog(f, Logicmp, "send icmphostunr -> src %I dst %I\n", p->src, p->dst);
else {
- netlog(f, Logicmp, "icmphostunr fail -> src %I dst %I\n",
- p->src, p->dst);
+ netlog(f, Logicmp, "icmphostunr fail -> src %I dst %I\n", p->src, p->dst);
+ runlock(ifc);
freeblist(nbp);
- if(free)
- goto clean;
- else
- return;
+ goto freebl;
}
memmove(np->dst, p->src, IPaddrlen);
@@ -462,14 +458,12 @@ icmphostunr(Fs *f, Ipifc *ifc, Block *bp, int code, int free)
if(free)
ipiput6(f, ifc, nbp);
- else {
+ else
ipoput6(f, nbp, 0, MAXTTL, DFLTTOS, nil);
- return;
- }
-
-clean:
runlock(ifc);
- freeblist(bp);
+freebl:
+ if(free)
+ freeblist(bp);
}
extern void