Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) (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 A24AD38D68B for ; Fri, 20 Mar 2026 10:18:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.160.73.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774001939; cv=none; b=GSDeYC1y94iWahOEXoP0OFc8tXXCoxfdtGfUtHdeTjcGTly+eLmasj6jK4bPR3dkgIWEhGBvpXIyTACXXuLgpjyVlRSbJxgXm93jH+xCr4tmo5/aTEq5jOJlVZtbr+gJlzafg2ow587JYgzL6a4/Tg9Z4xrVJHnItjb64UFXaS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774001939; c=relaxed/simple; bh=r5QPv00cbSjaiHlEndGXtd6J9lWwJ+ipO1cfMiBTSvw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l7fMPhWjxEccyCcjGKkNWcmFFIwqbLAPAmmzUObMKv6V7H014Wokzernr3OHAyZMQJyILcH/yZDxX5uzFkPnIPKpwDSj3SnswJLoPOnTOCwaVCVIdvTAxAHr/rnmE/o31EaVzejbUzX7c4ZetKxPjuvMCd/wWDTFeGvm7Cl3laY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org; spf=pass smtp.mailfrom=narfation.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b=tL7LMOd9; arc=none smtp.client-ip=213.160.73.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=narfation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=narfation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="tL7LMOd9" Received: by dvalin.narfation.org (Postfix) id 9B09D2035A; Fri, 20 Mar 2026 10:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1774001927; 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=4NdzyQEmCPszGyI4LLdMYuA0h6cotbbT1rRui9D682E=; b=tL7LMOd9iVJQfu4rvAF0MaFo21lIjI6H/00Fy6CwMzM4y8qn/wHW8ODLKPvBFB3i1Ehz3P y8omQjcfK6iBAXdnBP5f/4KmODl8V2NCscc/YgPXbJviXCcwDS2p3w1084o47b+/kqdO/X JFfiCXPtdxoETqj0HkufSwJbqHdAAJc= From: Sven Eckelmann To: stable@vger.kernel.org Cc: Yang Yang , Yifan Wu , Juefei Pu , Yuan Tan , Xin Liu , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 6.6.y] batman-adv: avoid OGM aggregation when skb tailroom is insufficient Date: Fri, 20 Mar 2026 11:18:44 +0100 Message-ID: <20260320101844.1630480-1-sven@narfation.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <2026032000-grumpily-detonator-0c67@gregkh> References: <2026032000-grumpily-detonator-0c67@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Yang Yang commit 0d4aef630be9d5f9c1227d07669c26c4383b5ad0 upstream. When OGM aggregation state is toggled at runtime, an existing forwarded packet may have been allocated with only packet_len bytes, while a later packet can still be selected for aggregation. Appending in this case can hit skb_put overflow conditions. Reject aggregation when the target skb tailroom cannot accommodate the new packet. The caller then falls back to creating a new forward packet instead of appending. Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol") Cc: stable@vger.kernel.org Reported-by: Yifan Wu Reported-by: Juefei Pu Signed-off-by: Yuan Tan Signed-off-by: Xin Liu Signed-off-by: Ao Zhou Signed-off-by: Yang Yang Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich [ Adjust context ] Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 209180b4c268..c31edbd7c2ab 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -464,6 +464,9 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, !time_after_eq(aggregation_end_time, forw_packet->send_time)) return false; + if (skb_tailroom(forw_packet->skb) < packet_len) + return false; + if (aggregated_bytes > BATADV_MAX_AGGREGATION_BYTES) return false; -- 2.47.3