Skip to content

Commit a063f2f

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Don't skb_split skbuffs with frag_list
The receiving interface might have used GRO to receive more fragments than MAX_SKB_FRAGS fragments. In this case, these will not be stored in skb_shinfo(skb)->frags but merged into the frag list. batman-adv relies on the function skb_split to split packets up into multiple smaller packets which are not larger than the MTU on the outgoing interface. But this function cannot handle frag_list entries and is only operating on skb_shinfo(skb)->frags. If it is still trying to split such an skb and xmit'ing it on an interface without support for NETIF_F_FRAGLIST, then validate_xmit_skb() will try to linearize it. But this fails due to inconsistent information. And __pskb_pull_tail will trigger a BUG_ON after skb_copy_bits() returns an error. In case of entries in frag_list, just linearize the skb before operating on it with skb_split(). Reported-by: Felix Kaechele <[email protected]> Fixes: c6c8fea ("net: Add batman-adv meshing protocol") Signed-off-by: Sven Eckelmann <[email protected]> Tested-by: Felix Kaechele <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent 3123109 commit a063f2f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/batman-adv/fragmentation.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,17 @@ int batadv_frag_send_packet(struct sk_buff *skb,
475475
goto free_skb;
476476
}
477477

478+
/* GRO might have added fragments to the fragment list instead of
479+
* frags[]. But this is not handled by skb_split and must be
480+
* linearized to avoid incorrect length information after all
481+
* batman-adv fragments were created and submitted to the
482+
* hard-interface
483+
*/
484+
if (skb_has_frag_list(skb) && __skb_linearize(skb)) {
485+
ret = -ENOMEM;
486+
goto free_skb;
487+
}
488+
478489
/* Create one header to be copied to all fragments */
479490
frag_header.packet_type = BATADV_UNICAST_FRAG;
480491
frag_header.version = BATADV_COMPAT_VERSION;

0 commit comments

Comments
 (0)