aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2011-08-04 10:07:39 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-05 06:31:03 -0400
commit98382f419f32d2c12d021943b87dea555677144b (patch)
treed07b99ec8eec119b53ddc2223de9027d7a8c0263 /net/socket.c
parent728ffb86f10873aaf4abd26dde691ee40ae731fe (diff)
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: Anton Blanchard <anton@samba.org> Cc: stable <stable@kernel.org> [3.0+] Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index e4ed2359eb43..b5c6de4f268a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1999,6 +1999,9 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
1999 struct compat_mmsghdr __user *compat_entry; 1999 struct compat_mmsghdr __user *compat_entry;
2000 struct msghdr msg_sys; 2000 struct msghdr msg_sys;
2001 2001
2002 if (vlen > UIO_MAXIOV)
2003 vlen = UIO_MAXIOV;
2004
2002 datagrams = 0; 2005 datagrams = 0;
2003 2006
2004 sock = sockfd_lookup_light(fd, &err, &fput_needed); 2007 sock = sockfd_lookup_light(fd, &err, &fput_needed);