提交 d891f632 编写于 作者: W Willem de Bruijn 提交者: sanglipeng

packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE

stable inclusion
from stable-v5.10.158
commit 1c38c88acc9688e9e379c26fb64bdfbb853618d1
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7NTXH

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

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

[ Upstream commit b85f628a ]

CHECKSUM_COMPLETE signals that skb->csum stores the sum over the
entire packet. It does not imply that an embedded l4 checksum
field has been validated.

Fixes: 682f048b ("af_packet: pass checksum validation status to the user")
Signed-off-by: NWillem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20221128161812.640098-1-willemdebruijn.kernel@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 ffa436f0
...@@ -2253,8 +2253,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -2253,8 +2253,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
if (skb->ip_summed == CHECKSUM_PARTIAL) if (skb->ip_summed == CHECKSUM_PARTIAL)
status |= TP_STATUS_CSUMNOTREADY; status |= TP_STATUS_CSUMNOTREADY;
else if (skb->pkt_type != PACKET_OUTGOING && else if (skb->pkt_type != PACKET_OUTGOING &&
(skb->ip_summed == CHECKSUM_COMPLETE || skb_csum_unnecessary(skb))
skb_csum_unnecessary(skb)))
status |= TP_STATUS_CSUM_VALID; status |= TP_STATUS_CSUM_VALID;
if (snaplen > res) if (snaplen > res)
...@@ -3490,8 +3489,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, ...@@ -3490,8 +3489,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
if (skb->ip_summed == CHECKSUM_PARTIAL) if (skb->ip_summed == CHECKSUM_PARTIAL)
aux.tp_status |= TP_STATUS_CSUMNOTREADY; aux.tp_status |= TP_STATUS_CSUMNOTREADY;
else if (skb->pkt_type != PACKET_OUTGOING && else if (skb->pkt_type != PACKET_OUTGOING &&
(skb->ip_summed == CHECKSUM_COMPLETE || skb_csum_unnecessary(skb))
skb_csum_unnecessary(skb)))
aux.tp_status |= TP_STATUS_CSUM_VALID; aux.tp_status |= TP_STATUS_CSUM_VALID;
aux.tp_len = origlen; aux.tp_len = origlen;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册