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 E41F036AB7B for ; Fri, 20 Mar 2026 10:15:49 +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=1774001752; cv=none; b=E1DSx4FbodmqcifmSG65jh9udBTUfA+d0ZPYbL+AGbWmJvCWo+HQp48XpwWSUHyb2XABTR9K/jKriIDQhlgnPcIiw5KJO1AGBqW5TFeEFkd90J2N3GL185YRHxs1Rr0F244Tl112udcrvnSpHSe1bhe8bLCcNaYZu7rxymi7MMU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774001752; c=relaxed/simple; bh=7Sk/hLAYzB1yfvx9yRr9hJi0guHl6ii2pdWAt8QdU2o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LstXicWQI7S6PnHRD595+TF0lbp7kkz0RunSiCDGKzcKgcARxY88I2NDBxkI26kd2vYSQgI0SGVG2wcFs7BZ3ruSUX8mPwCEIS77xviMoKb7A0pKRQBhNNrWnXpn+65XPlaqCMT9Vz++MCPB4yiQk6AwX7RclSD8ogP8DZZEnIU= 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=Dpsfqdt2; 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="Dpsfqdt2" Received: by dvalin.narfation.org (Postfix) id 9539B20201; Fri, 20 Mar 2026 10:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1774001747; 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=N6g43X/GMQsJuBso7BCJ7EoPLL2XaCTJY9Kfp5Dt2Lg=; b=Dpsfqdt2egP12dViWNzYSbj2RkOFvgv50fFd8HWjS0ZHM3f7Cf00z42SBdsNn50QgrUsaa yuekLjoEZziCslAK6tuK4DKIun9DihjMM+kEi+k3jbnqZ2P0GOwkW7DX384Z79qRmRBdRT tcHvjoUFyJZ3fmedpOOMljdpuOyTyKc= 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.15.y] batman-adv: avoid OGM aggregation when skb tailroom is insufficient Date: Fri, 20 Mar 2026 11:15:40 +0100 Message-ID: <20260320101540.1580645-1-sven@narfation.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <2026032007-october-puma-6f9c@gregkh> References: <2026032007-october-puma-6f9c@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 db179c6a5912..587a9053b4d4 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -465,6 +465,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