Commit b40750d9 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by zhaoxiaoqiang11
Browse files

bpf: pull before calling skb_postpull_rcsum()

stable inclusion
from stable-v5.10.163
commit e68e088d0d6ada6dcc226d1ca147488f60abca0e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7PJ9N

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e68e088d0d6ada6dcc226d1ca147488f60abca0e



----------------------------------------------------

[ Upstream commit 54c3f1a8 ]

Anand hit a BUG() when pulling off headers on egress to a SW tunnel.
We get to skb_checksum_help() with an invalid checksum offset
(commit d7ea0d9d ("net: remove two BUG() from skb_checksum_help()")
converted those BUGs to WARN_ONs()).
He points out oddness in how skb_postpull_rcsum() gets used.
Indeed looks like we should pull before "postpull", otherwise
the CHECKSUM_PARTIAL fixup from skb_postpull_rcsum() will not
be able to do its job:

	if (skb->ip_summed == CHECKSUM_PARTIAL &&
	    skb_checksum_start_offset(skb) < 0)
		skb->ip_summed = CHECKSUM_NONE;

Reported-by: default avatarAnand Parthasarathy <anpartha@meta.com>
Fixes: 6578171a ("bpf: add bpf_skb_change_proto helper")
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Acked-by: default avatarStanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/r/20221220004701.402165-1-kuba@kernel.org


Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarzhaoxiaoqiang11 <zhaoxiaoqiang11@jd.com>
parent 4cfc3a73
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment