Date: Sun, 8 Jul 2012 12:26:33 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r238240 - stable/9/sys/netinet Message-ID: <201207081226.q68CQXnY051241@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207081226.q68CQXnY051241>