sock: propagate __sock_cmsg_send() error
authorEric Dumazet <edumazet@google.com>
Fri, 13 May 2016 13:14:37 +0000 (06:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 May 2016 17:46:23 +0000 (13:46 -0400)
__sock_cmsg_send() might return different error codes, not only -EINVAL.

Fixes: 24025c465f77 ("ipv4: process socket-level control messages in IPv4")
Fixes: ad1e46a83716 ("ipv6: process socket-level control messages in IPv6")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_sockglue.c
net/ipv6/datagram.c

index 5805762d7fc79a702f1d67e802992b822f66f000..71a52f4d4cffba2db9353f43dc817689bf4fab10 100644 (file)
@@ -247,8 +247,9 @@ int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc,
                }
 #endif
                if (cmsg->cmsg_level == SOL_SOCKET) {
-                       if (__sock_cmsg_send(sk, msg, cmsg, &ipc->sockc))
-                               return -EINVAL;
+                       err = __sock_cmsg_send(sk, msg, cmsg, &ipc->sockc);
+                       if (err)
+                               return err;
                        continue;
                }
 
index 00d0c2903173a96571983216f2839a93059cad22..37874e2f30edf98f31e2a5097761143d507d5b95 100644 (file)
@@ -746,8 +746,9 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
                }
 
                if (cmsg->cmsg_level == SOL_SOCKET) {
-                       if (__sock_cmsg_send(sk, msg, cmsg, sockc))
-                               return -EINVAL;
+                       err = __sock_cmsg_send(sk, msg, cmsg, sockc);
+                       if (err)
+                               return err;
                        continue;
                }