net: fixes for skb_send_sock
authorJohn Fastabend <john.fastabend@gmail.com>
Wed, 16 Aug 2017 05:31:34 +0000 (22:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Aug 2017 18:27:52 +0000 (11:27 -0700)
A couple fixes to new skb_send_sock infrastructure. However, no users
currently exist for this code (adding user in next handful of patches)
so it should not be possible to trigger a panic with existing in-kernel
code.

Fixes: 306b13eb3cf9 ("proto_ops: Add locked held versions of sendmsg and sendpage")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c
net/socket.c

index cb123590c67465af8e8112ee184f7e010fcf27e8..917da73d3ab3b82163cf0a9ee944da09cb5a391f 100644 (file)
@@ -2285,7 +2285,7 @@ do_frag_list:
 
                slen = min_t(int, len, skb_headlen(skb) - offset);
                kv.iov_base = skb->data + offset;
-               kv.iov_len = len;
+               kv.iov_len = slen;
                memset(&msg, 0, sizeof(msg));
 
                ret = kernel_sendmsg_locked(sk, &msg, &kv, 1, slen);
index b332d1e8e4e4f6e9ec3517062d0ed3879f6e29d0..c729625eb5d36b97fb799ff418405239dc9e68e1 100644 (file)
@@ -658,7 +658,7 @@ int kernel_sendmsg_locked(struct sock *sk, struct msghdr *msg,
        struct socket *sock = sk->sk_socket;
 
        if (!sock->ops->sendmsg_locked)
-               sock_no_sendmsg_locked(sk, msg, size);
+               return sock_no_sendmsg_locked(sk, msg, size);
 
        iov_iter_kvec(&msg->msg_iter, WRITE | ITER_KVEC, vec, num, size);