From f24618aaf0b2fd9497568ddcce2a168550040887 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 3 Jun 2006 19:29:26 +0000 Subject: [PATCH] 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 --- sys/netinet/udp_usrreq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 5118290e319..84c5521f659 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);