Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2022 20:30:07 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d60ea9a10a79 - main - sockets: return EMSGSIZE if control part of message is too large
Message-ID:  <202205252030.24PKU7Ec040346@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=d60ea9a10a79b45491cd965b6006aadf29badcf9

commit d60ea9a10a79b45491cd965b6006aadf29badcf9
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-05-25 20:29:04 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-05-25 20:29:04 +0000

    sockets: return EMSGSIZE if control part of message is too large
    
    Specification doesn't list an explicit error code for the control
    size specified by msg_control being too large.  But it does list
    EMSGSIZE as error code for "message is too large to be sent all at
    once (as the socket requires)".  It also lists EINVAL as code for
    the "The sum of the iov_len values overflows an ssize_t."  Given
    how generic and uninformative EINVAL is, the EMSGSIZE is more
    appropriate.
    
    https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
    
    Reviewed by:            markj
    Differential revision:  https://reviews.freebsd.org/D35316
---
 sys/kern/uipc_syscalls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 72336d31071c..fef5dce796d2 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1521,7 +1521,7 @@ sockargs(struct mbuf **mp, char *buf, socklen_t buflen, int type)
 		else
 #endif
 			if (buflen > MCLBYTES)
-				return (EINVAL);
+				return (EMSGSIZE);
 	}
 	m = m_get2(buflen, M_WAITOK, type, 0);
 	m->m_len = buflen;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205252030.24PKU7Ec040346>