From: Eric Dumazet Date: Fri, 13 May 2016 13:14:37 +0000 (-0700) Subject: sock: propagate __sock_cmsg_send() error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2632616bc484de9281bc2a1f5b033325783f8a10;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git sock: propagate __sock_cmsg_send() error __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 Cc: Soheil Hassas Yeganeh Acked-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller --- diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 5805762d7fc7..71a52f4d4cff 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -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; } diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 00d0c2903173..37874e2f30ed 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -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; }