From: Anton Blanchard Date: Tue, 17 May 2011 19:38:57 +0000 (-0400) Subject: net: recvmmsg: Strip MSG_WAITFORONE when calling recvmsg X-Git-Tag: v2.6.39.1~158 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9aefae678abf4ba79f97983dd014135c3d46f96a;p=karo-tx-linux.git net: recvmmsg: Strip MSG_WAITFORONE when calling recvmsg commit b9eb8b8752804cecbacdb4d24b52e823cf07f107 upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- 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, */ 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);