]> git.itanic.dy.fi Git - linux-stable/commitdiff
bpf, sockmap: Use truesize with sk_rmem_schedule()
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 16 Nov 2020 22:28:26 +0000 (14:28 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:39:06 +0000 (13:39 +0100)
[ Upstream commit 70796fb751f1d34cc650e640572a174faf009cd4 ]

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>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/160556570616.73229.17003722112077507863.stgit@john-XPS-13-9370
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/skmsg.c

index eaf9c90389517537da46e26d4278d982b80625c1..4ac112cc490c54094372a62ee86d6b7f8db881ee 100644 (file)
@@ -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;
        }