Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05201C4332F for ; Wed, 24 Nov 2021 12:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343940AbhKXMvi (ORCPT ); Wed, 24 Nov 2021 07:51:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:55372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346374AbhKXMtK (ORCPT ); Wed, 24 Nov 2021 07:49:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 92F526141B; Wed, 24 Nov 2021 12:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637756925; bh=7sH9iGawK+BJ10fHt+KcHKovJHWVBj46z7VNArhimD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNtznGSSCD88oDeIGSYLlLR4EyUKHgZBcjNHkBoG70Cu821Ir+pR913ZHp/l4pyt/ p2zzbVhmW+9NHpS2cDvv7YlTAN/VBei6eaCHJpN/FcmV4kcHlxfJ2V9SpUja7gOLux DMbj5wKaYdl4LaWlX3PS8HRlthZ0dwAx4rKwudBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , =?UTF-8?q?Linus=20L=FCssing?= , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 4.14 245/251] batman-adv: Consider fragmentation for needed_headroom Date: Wed, 24 Nov 2021 12:58:07 +0100 Message-Id: <20211124115718.856304423@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115710.214900256@linuxfoundation.org> References: <20211124115710.214900256@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Eckelmann commit 4ca23e2c2074465bff55ea14221175fecdf63c5f upstream. If a batman-adv packets has to be fragmented, then the original batman-adv packet header is not stripped away. Instead, only a new header is added in front of the packet after it was split. This size must be considered to avoid cost intensive reallocations during the transmission through the various device layers. Fixes: 7bca68c7844b ("batman-adv: Add lower layer needed_(head|tail)room to own ones") Reported-by: Linus L?ssing Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sven Eckelmann Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/hard-interface.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -558,6 +558,9 @@ static void batadv_hardif_recalc_extra_s needed_headroom = lower_headroom + (lower_header_len - ETH_HLEN); needed_headroom += batadv_max_header_len(); + /* fragmentation headers don't strip the unicast/... header */ + needed_headroom += sizeof(struct batadv_frag_packet); + soft_iface->needed_headroom = needed_headroom; soft_iface->needed_tailroom = lower_tailroom; }