1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

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:
Mikolaj Golub 2012-09-02 07:29:37 +00:00
parent be7f7a955b
commit 2ad099fcb1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240003

View File

@ -1695,8 +1695,8 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio,
* 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;