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 76734C433EF for ; Wed, 24 Nov 2021 12:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245607AbhKXMdR (ORCPT ); Wed, 24 Nov 2021 07:33:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:43946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244980AbhKXM11 (ORCPT ); Wed, 24 Nov 2021 07:27:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76A9861242; Wed, 24 Nov 2021 12:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637756206; bh=mnAcbU4R7JM177vGJfIlgVya1BIvRZpwsqO59q/h59A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ewzYiW+qHusjAvFz0AVV2xYmjr/QQx4rKOsLmZxBB77/+5tthEW2uvgk6km/9hjHq 2MTgG73l+NI8b74ffFD3eJmfP25LljsRJalQgwuEHH3YPizl07DcgjL4tS+2iF8JdC uwbX0XF4zcWVSThzRZDq029olmvJcnsr/MRGx8Og= 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.9 202/207] batman-adv: Consider fragmentation for needed_headroom Date: Wed, 24 Nov 2021 12:57:53 +0100 Message-Id: <20211124115710.490931985@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115703.941380739@linuxfoundation.org> References: <20211124115703.941380739@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 @@ -359,6 +359,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; }