From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B201CEED8 for ; Fri, 19 Jun 2026 07:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.88.38.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781852459; cv=none; b=cP7k8r1dyO1GTnA/Wrvg/q/92jo9SscDCRo2W4/T2ijF7J43LI8WLXPGu7UEAMDiO3GF4Qb27ax0Cv2es2FjaZxTNW9yk7km2ZetaaFbQsVu6yn+92dxpjgAMTUc9pbupbCNHiS6UCEBXSV4pvDMv1/Nt24IIhryFH3SWKnpjPc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781852459; c=relaxed/simple; bh=8asyIdlzlMBz3UIHc+KMlmCGx/CE6fhpPBUVi/LHSoI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bzVgiZRsSCVyGoRUQ2OEWLp0I/w108TdDqhCxdt+62Nn2IAopRf7Rc1N28ttJkQae1qVwERfImo6rVaNovjRptuBCBKoVyvdQhWTaTxCskQm/Rhk/9ejFrJ5zGei900M0w0bB4O6Zg4gBpc2TJ3wygKJVqEjDKPNtxZtDHY6wvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de; spf=pass smtp.mailfrom=simonwunderlich.de; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b=UvUZRmtv; arc=none smtp.client-ip=23.88.38.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b="UvUZRmtv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simonwunderlich.de; s=09092022; t=1781852450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6e8joL+dyxKxUQbyUNURUpKgR0UCuyNlXRp5Lgytw+I=; b=UvUZRmtvX36M0a/pCOfje421DFjf89Qe+/29VPXjgBufuG01zBA2yUqJDYhCfnu+GWxwbb qw0MWYhE7sgAr/0JuQbGSwTjPRGDsdLu/R6DZ/OSs1hbWXlYzzXNCbudM/cCuDkHDVW8kS 3YHPJBG+lFLjiaPVNe3XEst9dbF0Up5k9/2cmORcxW+QoSlsCuCyVy+o1nd8i9xkT0oE1T gfR0Ip1UOBSOz/M6n0q5os027q3Ff7dFulTtZhPYhQm0rKuOLCD0TBhJAxfAN8xiEas+va +Lauwy5MgwkVEUcPok2fELI759sTE0H8gZnekEsHpbyXXqAFbfUHWrKUV4Ts9A== From: Simon Wunderlich To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann , stable@kernel.org, Simon Wunderlich Subject: [PATCH net 05/15] batman-adv: frag: avoid underflow of TTL Date: Fri, 19 Jun 2026 09:00:35 +0200 Message-ID: <20260619070045.438101-6-sw@simonwunderlich.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619070045.438101-1-sw@simonwunderlich.de> References: <20260619070045.438101-1-sw@simonwunderlich.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sven Eckelmann 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 Signed-off-by: Simon Wunderlich --- 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 f311a42203d2e..8a006a0473a87 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -417,6 +417,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