summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorSoheil Hassas Yeganeh <soheil@google.com>2018-02-27 18:22:40 -0500
committerDavid S. Miller <davem@davemloft.net>2018-03-01 21:27:49 -0500
commit7797dc41417eb0e03f39fc4356f7635bcdef108e (patch)
tree9ef5eb3e95c7ff55e975515a624ec7dd16a5c672 /net/socket.c
parent96dbdc5d8c48d438bb372fc3662c9a34fb44b498 (diff)
downloadlinux-7797dc41417eb0e03f39fc4356f7635bcdef108e.tar.bz2
socket: skip checking sk_err for recvmmsg(MSG_ERRQUEUE)
recvmmsg does not call ___sys_recvmsg when sk_err is set. That is fine for normal reads but, for MSG_ERRQUEUE, recvmmsg should always call ___sys_recvmsg regardless of sk->sk_err to be able to clear error queue. Otherwise, users are not able to drain the error queue using recvmmsg. Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c
index 645d32b4872c..d9a1ac233b35 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2289,10 +2289,12 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
if (!sock)
return err;
- err = sock_error(sock->sk);
- if (err) {
- datagrams = err;
- goto out_put;
+ if (likely(!(flags & MSG_ERRQUEUE))) {
+ err = sock_error(sock->sk);
+ if (err) {
+ datagrams = err;
+ goto out_put;
+ }
}
entry = mmsg;