Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98382f41 authored by Anton Blanchard's avatar Anton Blanchard Committed by David S. Miller
Browse files

net: Cap number of elements for sendmmsg



To limit the amount of time we can spend in sendmmsg, cap the
number of elements to UIO_MAXIOV (currently 1024).

For error handling an application using sendmmsg needs to retry at
the first unsent message, so capping is simpler and requires less
application logic than returning EINVAL.

Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Cc: stable <stable@kernel.org> [3.0+]
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 728ffb86
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1999,6 +1999,9 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
	struct compat_mmsghdr __user *compat_entry;
	struct msghdr msg_sys;

	if (vlen > UIO_MAXIOV)
		vlen = UIO_MAXIOV;

	datagrams = 0;

	sock = sockfd_lookup_light(fd, &err, &fput_needed);