From mboxrd@z Thu Jan 1 00:00:00 1970 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 B26D138AC98 for ; Fri, 20 Mar 2026 10:18:17 +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=1774001902; cv=none; b=hry32XHgspN52z6XvWEk6qiyXMyUjNvxzivIFNf8wh6eVGf6zQwPVWHXvPwd7I52GuJlkmsGdF7iBjL5ItnnkOYnhKHQmMklEtRw+iXJCduSLNnwcmSmJ9i03ac+UQCWezB7nf+OtJDtyuGS9yedWaGBC/tvWwW5geeFBpbCRBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774001902; c=relaxed/simple; bh=GwemKiRGS3NgmQH44D46vqQ2mHmH9x7CQeSMSkKZNqQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mULxDLPVGkEpnpmmGshRBs9EbPRiEBdrIbejGBE3uuFDgnH17LUzMRt7cSQIL+TMRx4Ov9TD7jjZ7juyoOrWJJY2+nkVca0PBvfJZSG9IngN01prTTYRZ6G13k5lOq3pvIW1vf4BBeGQYKC00NmCcXPb4k1pYe0LB+hmt3gqEco= 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=oHS1F8z3; 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="oHS1F8z3" Received: by dvalin.narfation.org (Postfix) id 39A092035A; Fri, 20 Mar 2026 10:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1774001562; 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=nqLsa7PrSP5cb3H1BgIlqOmthS/x4WAWvePSo3rR98Y=; b=oHS1F8z355lycemUKuvxFWxQyLXx9tvpVWuyNBf6t/ooOMaM+7Edp0GWRj9QJjiwmP2hRG hV6HwzBgROCcsZbsfLUurGCLMLVF44PoDFY6v++xTxXkeZ7hStE1zQIFf5fpIDGkTt7aCA XhAn5DLVAR3wZw0BsTXLJjZgLvOkR/I= 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 5.10.y] batman-adv: avoid OGM aggregation when skb tailroom is insufficient Date: Fri, 20 Mar 2026 11:12:23 +0100 Message-ID: <20260320101223.1554036-1-sven@narfation.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <2026032010-diagram-mayflower-0bd9@gregkh> References: <2026032010-diagram-mayflower-0bd9@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 e0b41afa3472..68ac19c75ed1 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -466,6 +466,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