diff options
author | Anton Blanchard <anton@samba.org> | 2011-05-17 15:38:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-17 15:38:57 -0400 |
commit | b9eb8b8752804cecbacdb4d24b52e823cf07f107 (patch) | |
tree | a8f57f2fc019c8bd7249762d367e717d5d93fc29 /net/socket.c | |
parent | 30b9284db3c77a5e20bb826cd1b66ed7b26cb726 (diff) |
net: recvmmsg: Strip MSG_WAITFORONE when calling recvmsg
recvmmsg fails on a raw socket with EINVAL. The reason for this is
packet_recvmsg checks the incoming flags:
err = -EINVAL;
if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT|MSG_ERRQUEUE))
goto out;
This patch strips out MSG_WAITFORONE when calling recvmmsg which
fixes the issue.
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@kernel.org [2.6.34+]
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/socket.c b/net/socket.c index 310d16b1b3c9..65b2310a2cb2 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -2122,14 +2122,16 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, | |||
2122 | */ | 2122 | */ |
2123 | if (MSG_CMSG_COMPAT & flags) { | 2123 | if (MSG_CMSG_COMPAT & flags) { |
2124 | err = __sys_recvmsg(sock, (struct msghdr __user *)compat_entry, | 2124 | err = __sys_recvmsg(sock, (struct msghdr __user *)compat_entry, |
2125 | &msg_sys, flags, datagrams); | 2125 | &msg_sys, flags & ~MSG_WAITFORONE, |
2126 | datagrams); | ||
2126 | if (err < 0) | 2127 | if (err < 0) |
2127 | break; | 2128 | break; |
2128 | err = __put_user(err, &compat_entry->msg_len); | 2129 | err = __put_user(err, &compat_entry->msg_len); |
2129 | ++compat_entry; | 2130 | ++compat_entry; |
2130 | } else { | 2131 | } else { |
2131 | err = __sys_recvmsg(sock, (struct msghdr __user *)entry, | 2132 | err = __sys_recvmsg(sock, (struct msghdr __user *)entry, |
2132 | &msg_sys, flags, datagrams); | 2133 | &msg_sys, flags & ~MSG_WAITFORONE, |
2134 | datagrams); | ||
2133 | if (err < 0) | 2135 | if (err < 0) |
2134 | break; | 2136 | break; |
2135 | err = put_user(err, &entry->msg_len); | 2137 | err = put_user(err, &entry->msg_len); |