Netdev List
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: davem@davemloft.net, ast@fb.com
Cc: netdev@vger.kernel.org, daniel@iogearbox.net
Subject: [RFC PATCH 3/6] net: fixes for skb_send_sock
Date: Thu, 03 Aug 2017 16:37:36 -0700	[thread overview]
Message-ID: <20170803233736.12107.95453.stgit@john-Precision-Tower-5810> (raw)
In-Reply-To: <20170803232443.12107.24752.stgit@john-Precision-Tower-5810>

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 in-kernel code.

Fixes: 306b13eb3cf9 ("proto_ops: Add locked held versions of sendmsg and sendpage")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 net/core/skbuff.c |    2 +-
 net/socket.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0f0933b..a0504a5 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2011,7 +2011,7 @@ int skb_send_sock_locked(struct sock *sk, struct sk_buff *skb, int offset,
 
 		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);
diff --git a/net/socket.c b/net/socket.c
index b332d1e..c729625 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -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);
 

  parent reply	other threads:[~2017-08-03 23:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 23:36 [RFC PATCH 0/6] BPF socket redirect John Fastabend
2017-08-03 23:36 ` [RFC PATCH 1/6] net: early init support for strparser John Fastabend
2017-08-03 23:37 ` [RFC PATCH 2/6] net: add sendmsg_locked and sendpage_locked to af_inet6 John Fastabend
2017-08-03 23:37 ` John Fastabend [this message]
2017-08-03 23:37 ` [RFC PATCH 4/6] net: sockmap with sk redirect support John Fastabend
2017-08-04  4:22   ` Tom Herbert
2017-08-04  4:49     ` John Fastabend
2017-08-04  4:49     ` John Fastabend
2017-08-03 23:38 ` [RFC PATCH 5/6] net: bpf, add skb to sk lookup routines John Fastabend
2017-08-03 23:38 ` [RFC PATCH 6/6] net: sockmap sample program John Fastabend

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170803233736.12107.95453.stgit@john-Precision-Tower-5810 \
    --to=john.fastabend@gmail.com \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox