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.
This commit is contained in:
parent
10c37ef567
commit
e3e0b9a496
@ -949,6 +949,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
|
||||
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 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
|
||||
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 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
|
||||
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 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
|
||||
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
|
||||
sbunlock(&so->so_rcv);
|
||||
out:
|
||||
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
|
||||
SOCKBUF_UNLOCK(&so->so_rcv);
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user