[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110517085924.3a47b8e2@kryten>
Date: Tue, 17 May 2011 08:59:24 +1000
From: Anton Blanchard <anton@...ba.org>
To: acme@...hat.com, davem@...emloft.net
Cc: netdev@...r.kernel.org
Subject: [PATCH] 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@...ba.org>
Cc: stable@...nel.org [2.6.34+]
---
We could also add MSG_WAITFORONE to the raw socket recvmsg check, or
just remove the check completely. Thoughts?
Index: linux-net/net/socket.c
===================================================================
--- linux-net.orig/net/socket.c 2011-05-09 08:59:22.757767314 +1000
+++ linux-net/net/socket.c 2011-05-16 17:14:52.501268819 +1000
@@ -2232,14 +2232,16 @@ int __sys_recvmmsg(int fd, struct mmsghd
*/
if (MSG_CMSG_COMPAT & flags) {
err = __sys_recvmsg(sock, (struct msghdr __user *)compat_entry,
- &msg_sys, flags, datagrams);
+ &msg_sys, flags & ~MSG_WAITFORONE,
+ datagrams);
if (err < 0)
break;
err = __put_user(err, &compat_entry->msg_len);
++compat_entry;
} else {
err = __sys_recvmsg(sock, (struct msghdr __user *)entry,
- &msg_sys, flags, datagrams);
+ &msg_sys, flags & ~MSG_WAITFORONE,
+ datagrams);
if (err < 0)
break;
err = put_user(err, &entry->msg_len);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists