summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-03-14 22:15:14 +0000
committerrwatson <rwatson@FreeBSD.org>2005-03-14 22:15:14 +0000
commited061ba4b1b1fcb35ba4e12e2aba1f546b5c3121 (patch)
treef5c38fed8e67a8c337a70c51533965840c459cad /sys/netinet/tcp_usrreq.c
parent48e4a931e3036791d274f742663d2a57e1999015 (diff)
downloadFreeBSD-src-ed061ba4b1b1fcb35ba4e12e2aba1f546b5c3121.zip
FreeBSD-src-ed061ba4b1b1fcb35ba4e12e2aba1f546b5c3121.tar.gz
In tcp_usr_send(), broaden coverage of the socket buffer lock in the
non-OOB case so that the sbspace() check is performed under the same lock instance as the append to the send socket buffer. MFC after: 1 week
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index e5ddf58..ee3970d 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -702,7 +702,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
tp->t_flags &= ~TF_MORETOCOME;
}
} else {
+ SOCKBUF_LOCK(&so->so_snd);
if (sbspace(&so->so_snd) < -512) {
+ SOCKBUF_UNLOCK(&so->so_snd);
m_freem(m);
error = ENOBUFS;
goto out;
@@ -715,7 +717,8 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
* of data past the urgent section.
* Otherwise, snd_up should be one lower.
*/
- sbappendstream(&so->so_snd, m);
+ sbappendstream_locked(&so->so_snd, m);
+ SOCKBUF_UNLOCK(&so->so_snd);
if (nam && tp->t_state < TCPS_SYN_SENT) {
/*
* Do implied connect if not yet connected,
OpenPOWER on IntegriCloud