Skip to content

Commit 6cd021a

Browse files
wdebruijdavem330
authored andcommitted
udp: segment looped gso packets correctly
Multicast and broadcast packets can be looped from egress to ingress pre segmentation with dev_loopback_xmit. That function unconditionally sets ip_summed to CHECKSUM_UNNECESSARY. udp_rcv_segment segments gso packets in the udp rx path. Segmentation usually executes on egress, and does not expect packets of this type. __udp_gso_segment interprets !CHECKSUM_PARTIAL as CHECKSUM_NONE. But the offsets are not correct for gso_make_checksum. UDP GSO packets are of type CHECKSUM_PARTIAL, with their uh->check set to the correct pseudo header checksum. Reset ip_summed to this type. (CHECKSUM_PARTIAL is allowed on ingress, see comments in skbuff.h) Reported-by: syzbot <[email protected]> Fixes: cf329aa ("udp: cope with UDP GRO packet misdirection") Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3127642 commit 6cd021a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/net/udp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
476476
if (!inet_get_convert_csum(sk))
477477
features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
478478

479+
if (skb->pkt_type == PACKET_LOOPBACK)
480+
skb->ip_summed = CHECKSUM_PARTIAL;
481+
479482
/* the GSO CB lays after the UDP one, no need to save and restore any
480483
* CB fragment
481484
*/

0 commit comments

Comments
 (0)