udp: Validate checksum in udp_read_sock()
authorCong Wang <cong.wang@bytedance.com>
Mon, 15 Nov 2021 04:40:06 +0000 (20:40 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Nov 2021 08:48:37 +0000 (09:48 +0100)
commit67fb5eac4063e884f029daa5bd94cbcf7bf3cebe
treea508a29cfe90f0c80aeefe06b4beb5ab62106753
parentb4a677ffb67e3c0319d471ad2d31f206ab470be6
udp: Validate checksum in udp_read_sock()

[ Upstream commit 099f896f498a2b26d84f4ddae039b2c542c18b48 ]

It turns out the skb's in sock receive queue could have bad checksums, as
both ->poll() and ->recvmsg() validate checksums. We have to do the same
for ->read_sock() path too before they are redirected in sockmap.

Fixes: d7f571188ecf ("udp: Implement ->read_sock() for sockmap")
Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20211115044006.26068-1-xiyou.wangcong@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/udp.c