diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-07-10 03:47:15 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-07-10 03:47:15 +0000 |
commit | e3e0b9a4965c0ec28fea8c7758879a84127e67d2 (patch) | |
tree | 3d775fb268012533a0177b5d502493e11bf9f6b3 /sys/kern/uipc_socket.c | |
parent | 10c37ef567a96811a59fb7740997f36fbb45a143 (diff) | |
download | FreeBSD-src-e3e0b9a4965c0ec28fea8c7758879a84127e67d2.zip FreeBSD-src-e3e0b9a4965c0ec28fea8c7758879a84127e67d2.tar.gz |
Assert socket buffer lock at strategic points between sections of code
in soreceive() to confirm we've moved from block to block properly
maintaining locking invariants.
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 030ca5b..8b0bc25 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -949,6 +949,7 @@ restart: so->so_error = 0; goto release; } + SOCKBUF_LOCK_ASSERT(&so->so_rcv); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { if (m) goto dontblock; @@ -1115,6 +1116,7 @@ dontblock: goto release; } else uio->uio_resid -= len; + SOCKBUF_LOCK_ASSERT(&so->so_rcv); if (len == m->m_len - moff) { if (m->m_flags & M_EOR) flags |= MSG_EOR; @@ -1158,6 +1160,7 @@ dontblock: so->so_rcv.sb_cc -= len; } } + SOCKBUF_LOCK_ASSERT(&so->so_rcv); if (so->so_oobmark) { if ((flags & MSG_PEEK) == 0) { so->so_oobmark -= len; @@ -1206,6 +1209,7 @@ dontblock: } } + SOCKBUF_LOCK_ASSERT(&so->so_rcv); if (m != NULL && pr->pr_flags & PR_ATOMIC) { flags |= MSG_TRUNC; if ((flags & MSG_PEEK) == 0) { @@ -1248,6 +1252,7 @@ release: SOCKBUF_LOCK_ASSERT(&so->so_rcv); sbunlock(&so->so_rcv); out: + SOCKBUF_LOCK_ASSERT(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_rcv); return (error); } |