In soreceive_generic() when checking if the type of mbuf has changed

check it for MT_CONTROL type too, otherwise the assertion
"m->m_type == MT_DATA" below may be triggered by the following scenario:

- the sender sends some data (MT_DATA) and then a file descriptor
  (MT_CONTROL);
- the receiver calls recv(2) with a MSG_WAITALL asking for data larger
  than the receive buffer (uio_resid > hiwat).

MFC after:	2 week
This commit is contained in:
trociny 2012-09-02 07:29:37 +00:00
parent fb02ef2ab9
commit e483d14d74

View File

@ -1695,8 +1695,8 @@ dontblock:
* examined ('type'), end the receive operation.
*/
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
if (m->m_type == MT_OOBDATA) {
if (type != MT_OOBDATA)
if (m->m_type == MT_OOBDATA || m->m_type == MT_CONTROL) {
if (type != m->m_type)
break;
} else if (type == MT_OOBDATA)
break;