packet: propagate sock_cmsg_send() error
authorSoheil Hassas Yeganeh <soheil@google.com>
Wed, 20 Jul 2016 22:01:18 +0000 (18:01 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Jul 2016 05:41:48 +0000 (01:41 -0400)
sock_cmsg_send() can return different error codes and not only
-EINVAL, and we should properly propagate them.

Fixes: c14ac9451c34 ("sock: enable timestamping using control messages")
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c

index 53e87ceb26e7ff17e186a7f20d4c5373afa8e094..b43c4015b2f79678bb5a2edffdd4e57cf9bdb880 100644 (file)
@@ -1930,10 +1930,8 @@ retry:
        sockc.tsflags = sk->sk_tsflags;
        if (msg->msg_controllen) {
                err = sock_cmsg_send(sk, msg, &sockc);
-               if (unlikely(err)) {
-                       err = -EINVAL;
+               if (unlikely(err))
                        goto out_unlock;
-               }
        }
 
        skb->protocol = proto;