Author: bz Date: Sun Jul 8 12:26:32 2012 New Revision: 238240 URL: http://svn.freebsd.org/changeset/base/238240
Log: MFC r235985: Properly protect the inp read access when handling the control code. In the past this was expensive but given the rlock it's not so much anymore. Approved by: re Modified: stable/9/sys/netinet/udp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/udp_usrreq.c ============================================================================== --- stable/9/sys/netinet/udp_usrreq.c Sun Jul 8 12:23:27 2012 (r238239) +++ stable/9/sys/netinet/udp_usrreq.c Sun Jul 8 12:26:32 2012 (r238240) @@ -972,6 +972,7 @@ udp_output(struct inpcb *inp, struct mbu } src.sin_family = 0; + INP_RLOCK(inp); tos = inp->inp_ip_tos; if (control != NULL) { /* @@ -979,6 +980,7 @@ udp_output(struct inpcb *inp, struct mbu * stored in a single mbuf. */ if (control->m_next) { + INP_RUNLOCK(inp); m_freem(control); m_freem(m); return (EINVAL); @@ -1028,6 +1030,7 @@ udp_output(struct inpcb *inp, struct mbu m_freem(control); } if (error) { + INP_RUNLOCK(inp); m_freem(m); return (error); } @@ -1049,7 +1052,6 @@ udp_output(struct inpcb *inp, struct mbu * XXXRW: Check that hash locking update here is correct. */ sin = (struct sockaddr_in *)addr; - INP_RLOCK(inp); if (sin != NULL && (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) { INP_RUNLOCK(inp); _______________________________________________ svn-src-stable-9@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"