All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: jakub@cloudflare.com, ast@kernel.org, daniel@iogearbox.net
Cc: john.fastabend@gmail.com, bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: [bpf PATCH v3 3/6] bpf, sockmap: Use truesize with sk_rmem_schedule()
Date: Mon, 16 Nov 2020 14:28:26 -0800	[thread overview]
Message-ID: <160556570616.73229.17003722112077507863.stgit@john-XPS-13-9370> (raw)
In-Reply-To: <160556562395.73229.12161576665124541961.stgit@john-XPS-13-9370>

We use skb->size with sk_rmem_scheduled() which is not correct. Instead
use truesize to align with socket and tcp stack usage of sk_rmem_schedule.

Suggested-by: Daniel Borkman <daniel@iogearbox.net>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 net/core/skmsg.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index fe44280c033e..d09426ce4af3 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -411,7 +411,7 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)
 	msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC);
 	if (unlikely(!msg))
 		return -EAGAIN;
-	if (!sk_rmem_schedule(sk, skb, skb->len)) {
+	if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
 		kfree(msg);
 		return -EAGAIN;
 	}



  parent reply	other threads:[~2020-11-16 22:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 22:27 [bpf PATCH v3 0/6] sockmap fixes John Fastabend
2020-11-16 22:27 ` [bpf PATCH v3 1/6] bpf, sockmap: fix partial copy_page_to_iter so progress can still be made John Fastabend
2020-11-16 22:28 ` [bpf PATCH v3 2/6] bpf, sockmap: Ensure SO_RCVBUF memory is observed on ingress redirect John Fastabend
2020-11-16 22:28 ` John Fastabend [this message]
2020-11-16 22:28 ` [bpf PATCH v3 4/6] bpf, sockmap: Avoid returning unneeded EAGAIN when redirecting to self John Fastabend
2020-11-16 22:29 ` [bpf PATCH v3 5/6] bpf, sockmap: Handle memory acct if skb_verdict prog redirects " John Fastabend
2020-11-17  8:21   ` Jakub Sitnicki
2020-11-16 22:29 ` [bpf PATCH v3 6/6] bpf, sockmap: Avoid failures from skb_to_sgvec when skb has frag_list John Fastabend
2020-11-17 23:20 ` [bpf PATCH v3 0/6] sockmap fixes patchwork-bot+netdevbpf

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=160556570616.73229.17003722112077507863.stgit@john-XPS-13-9370 \
    --to=john.fastabend@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.