summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2013-03-31 11:18:35 +0000
committerbluhm <bluhm@openbsd.org>2013-03-31 11:18:35 +0000
commitae39fdefb07f899fb0eca4b9a5449774dc9da4f8 (patch)
treeeada1234f7c138eee3724394df14e9c639c0aab0 /sys/netinet6
parentProvide default resource allocation and free functions. Convert all (diff)
downloadwireguard-openbsd-ae39fdefb07f899fb0eca4b9a5449774dc9da4f8.tar.xz
wireguard-openbsd-ae39fdefb07f899fb0eca4b9a5449774dc9da4f8.zip
The call to in_pcballoc() in user request attach was handled in
three different ways. Use the same code in udp_usrreq() and rip_usrreq() and rip6_usrreq(). This also fixes a pcb and socket leak in udp_usrreq() in case soreserve() fails. Put an splsoftassert() into in_pcballoc() for safety. OK mpi@
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/raw_ip6.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 531efd0cece..d612011da99 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.50 2013/03/30 12:15:29 bluhm Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.51 2013/03/31 11:18:35 bluhm Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -593,8 +593,8 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct proc *p)
{
struct in6pcb *in6p = sotoin6pcb(so);
- int s;
int error = 0;
+ int s;
int priv;
priv = 0;
@@ -618,12 +618,8 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
break;
}
s = splsoftnet();
- if ((error = soreserve(so, rip6_sendspace, rip6_recvspace)) != 0) {
- splx(s);
- break;
- }
- if ((error = in_pcballoc(so, &rawin6pcbtable)) != 0)
- {
+ if ((error = soreserve(so, rip6_sendspace, rip6_recvspace)) ||
+ (error = in_pcballoc(so, &rawin6pcbtable))) {
splx(s);
break;
}