mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
net: Assert at build time the assumptions we make about the CMSG header.
It must always be the case that CMSG_ALIGN(sizeof(hdr)) == sizeof(hdr). Otherwise there are missing adjustments in the various calculations that parse and build these things. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -1948,6 +1948,8 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
|
||||
ctl_buf = msg_sys->msg_control;
|
||||
ctl_len = msg_sys->msg_controllen;
|
||||
} else if (ctl_len) {
|
||||
BUILD_BUG_ON(sizeof(struct cmsghdr) !=
|
||||
CMSG_ALIGN(sizeof(struct cmsghdr)));
|
||||
if (ctl_len > sizeof(ctl)) {
|
||||
ctl_buf = sock_kmalloc(sock->sk, ctl_len, GFP_KERNEL);
|
||||
if (ctl_buf == NULL)
|
||||
|
||||
Reference in New Issue
Block a user