Properly handle a closed TLS socket with pending receive data.
If the remote end closes a TLS socket and the socket buffer still contains not-yet-decrypted TLS records but no decrypted TLS records, soreceive needs to block or fail with EWOULDBLOCK. Previously it was trying to return data and dereferencing a NULL pointer. Reviewed by: np Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D25838
This commit is contained in:
parent
18fe0fbb0d
commit
09d9130258
@ -1965,12 +1965,17 @@ restart:
|
|||||||
}
|
}
|
||||||
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
|
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
|
||||||
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
|
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
|
||||||
if (m == NULL && so->so_rcv.sb_tlsdcc == 0 &&
|
if (m != NULL)
|
||||||
|
goto dontblock;
|
||||||
|
#ifdef KERN_TLS
|
||||||
|
else if (so->so_rcv.sb_tlsdcc == 0 &&
|
||||||
so->so_rcv.sb_tlscc == 0) {
|
so->so_rcv.sb_tlscc == 0) {
|
||||||
|
#else
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
SOCKBUF_UNLOCK(&so->so_rcv);
|
SOCKBUF_UNLOCK(&so->so_rcv);
|
||||||
goto release;
|
goto release;
|
||||||
} else
|
}
|
||||||
goto dontblock;
|
|
||||||
}
|
}
|
||||||
for (; m != NULL; m = m->m_next)
|
for (; m != NULL; m = m->m_next)
|
||||||
if (m->m_type == MT_OOBDATA || (m->m_flags & M_EOR)) {
|
if (m->m_type == MT_OOBDATA || (m->m_flags & M_EOR)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user