Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: stable@vger.kernel.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: [PATCH 6.1 15/25] batman-adv: frag: avoid underflow of TTL
Date: Fri, 26 Jun 2026 18:11:13 +0200	[thread overview]
Message-ID: <20260626161123.124273-16-sven@narfation.org> (raw)
In-Reply-To: <20260626161123.124273-1-sven@narfation.org>

commit 493d9d2528e1a09b090e4b37f0f553def7bd5ce9 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: 610bfc6bc99b ("batman-adv: Receive fragmented packets and merge")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/fragmentation.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index fbf030c57ac04..0138b0953e10b 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -420,6 +420,13 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
 	 */
 	total_size = ntohs(packet->total_size);
 	if (total_size > neigh_node->if_incoming->net_dev->mtu) {
+		if (packet->ttl < 2) {
+			kfree_skb(skb);
+			*rx_result = NET_RX_DROP;
+			ret = true;
+			goto out;
+		}
+
 		if (skb_cow(skb, ETH_HLEN) < 0) {
 			kfree_skb(skb);
 			*rx_result = NET_RX_DROP;
-- 
2.47.3


  parent reply	other threads:[~2026-06-26 16:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 16:10 [PATCH 6.1 00/25] batman-adv: 7.2 merge window fixes backports Sven Eckelmann
2026-06-26 16:10 ` [PATCH 6.1 01/25] batman-adv: tp_meter: keep unacked list in ascending ordered Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 02/25] batman-adv: tp_meter: initialize dup_acks explicitly Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 03/25] batman-adv: tp_meter: initialize dec_cwnd explicitly Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 04/25] batman-adv: tp_meter: avoid window underflow Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 05/25] batman-adv: tp_meter: avoid divide-by-zero for dec_cwnd Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 06/25] batman-adv: tp_meter: fix fast recovery precondition Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 07/25] batman-adv: tp_meter: handle seqno wrap-around for fast recovery detection Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 08/25] batman-adv: tp_meter: add only finished tp_vars to lists Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 09/25] batman-adv: bla: annotate lasttime access with READ/WRITE_ONCE Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 10/25] batman-adv: prevent ELP transmission interval underflow Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 11/25] batman-adv: tp_meter: initialize last_recv_time during init Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 12/25] batman-adv: ensure bcast is writable before modifying TTL Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 13/25] batman-adv: fix (m|b)cast csum after decrementing TTL Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 14/25] batman-adv: frag: ensure fragment is writable before modifying TTL Sven Eckelmann
2026-06-26 16:11 ` Sven Eckelmann [this message]
2026-06-26 16:11 ` [PATCH 6.1 16/25] batman-adv: v: prevent OGM aggregation on disabled hardif Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 17/25] batman-adv: tp_meter: restrict number of unacked list entries Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 18/25] batman-adv: tp_meter: annotate last_recv_time access with READ/WRITE_ONCE Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 19/25] batman-adv: tp_meter: prevent parallel modifications of last_recv Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 20/25] batman-adv: tp_meter: handle overlapping packets Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 21/25] batman-adv: tt: don't merge change entries with different VIDs Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 22/25] batman-adv: tt: track roam count per VID Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 23/25] batman-adv: dat: prevent false sharing between VLANs Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 24/25] batman-adv: tvlv: enforce 2-byte alignment Sven Eckelmann
2026-06-26 16:11 ` [PATCH 6.1 25/25] batman-adv: tvlv: avoid race of cifsnotfound handler state Sven Eckelmann
2026-06-28  3:33 ` [PATCH 6.1 00/25] batman-adv: 7.2 merge window fixes backports Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260626161123.124273-16-sven@narfation.org \
    --to=sven@narfation.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox