summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-11-28 11:01:31 +0000
committerrwatson <rwatson@FreeBSD.org>2004-11-28 11:01:31 +0000
commitfb1ee2ed371291dbdcd2f4516c7cb80096208174 (patch)
treefb64343dc1532be3ca0ae1a29b9f3960641d3321
parentb7d2ffcc40f55d75cd042248aed225bdc617dfa2 (diff)
downloadFreeBSD-src-fb1ee2ed371291dbdcd2f4516c7cb80096208174.zip
FreeBSD-src-fb1ee2ed371291dbdcd2f4516c7cb80096208174.tar.gz
Expand coverage of the receive socket buffer lock when handling urgent
pointer updates: test available space while holding the socket buffer mutex, and continue to hold until until the pointer update has been performed. MFC after: 2 weeks
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet/tcp_reass.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 92032cc..9295666 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -2197,9 +2197,11 @@ step6:
* soreceive. It's hard to imagine someone
* actually wanting to send this much urgent data.
*/
+ SOCKBUF_LOCK(&so->so_rcv);
if (th->th_urp + so->so_rcv.sb_cc > sb_max) {
th->th_urp = 0; /* XXX */
thflags &= ~TH_URG; /* XXX */
+ SOCKBUF_UNLOCK(&so->so_rcv); /* XXX */
goto dodata; /* XXX */
}
/*
@@ -2218,15 +2220,14 @@ step6:
*/
if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
tp->rcv_up = th->th_seq + th->th_urp;
- SOCKBUF_LOCK(&so->so_rcv);
so->so_oobmark = so->so_rcv.sb_cc +
(tp->rcv_up - tp->rcv_nxt) - 1;
if (so->so_oobmark == 0)
so->so_rcv.sb_state |= SBS_RCVATMARK;
- SOCKBUF_UNLOCK(&so->so_rcv);
sohasoutofband(so);
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
}
+ SOCKBUF_UNLOCK(&so->so_rcv);
/*
* Remove out of band data so doesn't get presented to user.
* This can happen independent of advancing the URG pointer,
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index 92032cc..9295666 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -2197,9 +2197,11 @@ step6:
* soreceive. It's hard to imagine someone
* actually wanting to send this much urgent data.
*/
+ SOCKBUF_LOCK(&so->so_rcv);
if (th->th_urp + so->so_rcv.sb_cc > sb_max) {
th->th_urp = 0; /* XXX */
thflags &= ~TH_URG; /* XXX */
+ SOCKBUF_UNLOCK(&so->so_rcv); /* XXX */
goto dodata; /* XXX */
}
/*
@@ -2218,15 +2220,14 @@ step6:
*/
if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
tp->rcv_up = th->th_seq + th->th_urp;
- SOCKBUF_LOCK(&so->so_rcv);
so->so_oobmark = so->so_rcv.sb_cc +
(tp->rcv_up - tp->rcv_nxt) - 1;
if (so->so_oobmark == 0)
so->so_rcv.sb_state |= SBS_RCVATMARK;
- SOCKBUF_UNLOCK(&so->so_rcv);
sohasoutofband(so);
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
}
+ SOCKBUF_UNLOCK(&so->so_rcv);
/*
* Remove out of band data so doesn't get presented to user.
* This can happen independent of advancing the URG pointer,
OpenPOWER on IntegriCloud