From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D08AF3B0AD8; Mon, 23 Mar 2026 14:01:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274501; cv=none; b=JM2ejbiyqWx+/YH06rLx21GVcQwsHVhgvKoqyGCx2RMSC+1SOB6gac9C9VouapFFBct6rSWE+ZZ4+09rl67vrdBCxn0eFZVFFLgOMkbj42w0FDaNBFGGcxK90nbWupiCBzTlJGNi5aBQxFWKqgaLv14ErL4TlCKujutTO4Dq9H8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274501; c=relaxed/simple; bh=iS7oSVBGeDs5pmxoCfByhjIrt4iDtyby4015LJKCAl8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zy0uQtLAD/vkfEUkisQc5Jws9wHPWSdXVX9aD8Lk9U0lzkztB6sIaUYFDWm0KtkjOYf3YeGSWVGDFhEDGMi7VI+VguP7B677HAWYIeZBp87fpoZ7iLDDgAY8gRZXFOjjcB0Bn2fCL0NhBvXYXhlAh7I8Abxqppbrlh9D7cRUWZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DTAAqtaW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DTAAqtaW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 524DDC4CEF7; Mon, 23 Mar 2026 14:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274501; bh=iS7oSVBGeDs5pmxoCfByhjIrt4iDtyby4015LJKCAl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTAAqtaWvymtZyCUUcI8R/OE51+XqBzV5aH26xmDnrMD0sO6AgapLFsSR4QRpE4Ap fUSUwEMXz1vCUnGK2CHo8jaebXuiFTxeQanOg9u78XjQ3p7bzsWlUbr0/JxaTOtpkC /GXl0H9rKj4F1jrpvg+tV5orDtkJ5tbQ9ePoixYM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yifan Wu , Juefei Pu , Yuan Tan , Xin Liu , Ao Zhou , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 6.18 018/212] batman-adv: avoid OGM aggregation when skb tailroom is insufficient Date: Mon, 23 Mar 2026 14:43:59 +0100 Message-ID: <20260323134504.338004241@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134503.770111826@linuxfoundation.org> References: <20260323134503.770111826@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/bat_iv_ogm.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -473,6 +473,9 @@ batadv_iv_ogm_can_aggregate(const struct if (aggregated_bytes > max_bytes) return false; + if (skb_tailroom(forw_packet->skb) < packet_len) + return false; + if (packet_num >= BATADV_MAX_AGGREGATION_PACKETS) return false;