bareudp: Fix invalid read beyond skb's linear data
authorGuillaume Nault <gnault@redhat.com>
Fri, 6 Aug 2021 15:52:06 +0000 (17:52 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 9 Aug 2021 22:37:43 +0000 (15:37 -0700)
commit143a8526ab5fd4f8a0c4fe2a9cb28c181dc5a95f
tree9d2766c631ccc95b0ddd4103e80dbe46f1cf9e66
parentd6e712aa7e6a3d5a9633f4bcbe2237f3edc292bd
bareudp: Fix invalid read beyond skb's linear data

Data beyond the UDP header might not be part of the skb's linear data.
Use skb_copy_bits() instead of direct access to skb->data+X, so that
we read the correct bytes even on a fragmented skb.

Fixes: 4b5f67232d95 ("net: Special handling for IP & MPLS.")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Link: https://lore.kernel.org/r/7741c46545c6ef02e70c80a9b32814b22d9616b3.1628264975.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/bareudp.c