diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-06-03 19:29:26 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-06-03 19:29:26 +0000 |
commit | 133fd236d101c0bcc7a0d460848ed4ea4c15a47b (patch) | |
tree | 1a21d709ac1dbc4fffb9f1d9a4b6ef31673a0280 | |
parent | 8b0790bd13029bd6b270602cedfcbc4b36bfecad (diff) | |
download | FreeBSD-src-133fd236d101c0bcc7a0d460848ed4ea4c15a47b.zip FreeBSD-src-133fd236d101c0bcc7a0d460848ed4ea4c15a47b.tar.gz |
Acquire udbinfo lock after call to soreserve() rather than before, as it
is not required. This simplifies error-handling, and reduces the time
that this lock is held.
MFC after: 1 month
-rw-r--r-- | sys/netinet/udp_usrreq.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 5118290..84c5521 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -962,12 +962,10 @@ udp_attach(struct socket *so, int proto, struct thread *td) inp = sotoinpcb(so); KASSERT(inp == NULL, ("udp_attach: inp != NULL")); - INP_INFO_WLOCK(&udbinfo); error = soreserve(so, udp_sendspace, udp_recvspace); - if (error) { - INP_INFO_WUNLOCK(&udbinfo); + if (error) return error; - } + INP_INFO_WLOCK(&udbinfo); error = in_pcballoc(so, &udbinfo, "udpinp"); if (error) { INP_INFO_WUNLOCK(&udbinfo); |