Date: Thu, 9 Oct 2008 17:52:48 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r183726 - in stable/7/sys: . kern Message-ID: <200810091752.m99HqmLs067782@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Oct 9 17:52:47 2008 New Revision: 183726 URL: http://svn.freebsd.org/changeset/base/183726 Log: MFC: Wait until after dropping the receive socket buffer lock to allocate space to store the socket address stored in the first mbuf in a packet chain in soreceive_dgram(). Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/uipc_socket.c Modified: stable/7/sys/kern/uipc_socket.c ============================================================================== --- stable/7/sys/kern/uipc_socket.c Thu Oct 9 14:55:45 2008 (r183725) +++ stable/7/sys/kern/uipc_socket.c Thu Oct 9 17:52:47 2008 (r183726) @@ -1928,34 +1928,11 @@ soreceive_dgram(struct socket *so, struc SBLASTRECORDCHK(&so->so_rcv); SBLASTMBUFCHK(&so->so_rcv); nextrecord = m->m_nextpkt; - if (pr->pr_flags & PR_ADDR) { - KASSERT(m->m_type == MT_SONAME, - ("m->m_type == %d", m->m_type)); - if (psa != NULL) - *psa = sodupsockaddr(mtod(m, struct sockaddr *), - M_NOWAIT); - sbfree(&so->so_rcv, m); - so->so_rcv.sb_mb = m_free(m); - m = so->so_rcv.sb_mb; - sockbuf_pushsync(&so->so_rcv, nextrecord); - } - if (m == NULL) { - /* XXXRW: Can this happen? */ - SOCKBUF_UNLOCK(&so->so_rcv); - return (0); - } - KASSERT(m->m_nextpkt == nextrecord, - ("soreceive_dgram: post-control, nextrecord !sync")); if (nextrecord == NULL) { - KASSERT(so->so_rcv.sb_mb == m, - ("soreceive_dgram: post-control, sb_mb!=m")); KASSERT(so->so_rcv.sb_lastrecord == m, ("soreceive_dgram: lastrecord != m")); } - SBLASTRECORDCHK(&so->so_rcv); - SBLASTMBUFCHK(&so->so_rcv); - KASSERT(m == so->so_rcv.sb_mb, ("soreceive_dgram: m not sb_mb")); KASSERT(so->so_rcv.sb_mb->m_nextpkt == nextrecord, ("soreceive_dgram: m_nextpkt != nextrecord")); @@ -1978,6 +1955,19 @@ soreceive_dgram(struct socket *so, struc SBLASTMBUFCHK(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_rcv); + if (pr->pr_flags & PR_ADDR) { + KASSERT(m->m_type == MT_SONAME, + ("m->m_type == %d", m->m_type)); + if (psa != NULL) + *psa = sodupsockaddr(mtod(m, struct sockaddr *), + M_NOWAIT); + m = m_free(m); + } + if (m == NULL) { + /* XXXRW: Can this happen? */ + return (0); + } + /* * Packet to copyout() is now in 'm' and it is disconnected from the * queue.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810091752.m99HqmLs067782>