Skip to content

Commit 44ae137

Browse files
ecsvgregkh
authored andcommitted
batman-adv: frag: avoid underflow of TTL
commit 493d9d2 upstream. Packets with a TTL are using it to limit the amount of time this packet can be forwarded. But for batadv_frag_packet, the TTL was always only reduced but it was never evaluated. It could even underflow without any effect. Check the TTL in batadv_frag_skb_fwd() before attempting to prepare it for forwarding. This keeps it in sync with the not fragmented unicast packet. Cc: stable@kernel.org Fixes: 610bfc6 ("batman-adv: Receive fragmented packets and merge") Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 116e940 commit 44ae137

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

net/batman-adv/fragmentation.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,13 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
415415
*/
416416
total_size = ntohs(packet->total_size);
417417
if (total_size > neigh_node->if_incoming->net_dev->mtu) {
418+
if (packet->ttl < 2) {
419+
kfree_skb(skb);
420+
*rx_result = NET_RX_DROP;
421+
ret = true;
422+
goto out;
423+
}
424+
418425
if (skb_cow(skb, ETH_HLEN) < 0) {
419426
kfree_skb(skb);
420427
*rx_result = NET_RX_DROP;

0 commit comments

Comments
 (0)