Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp889178rwb; Mon, 26 Sep 2022 07:09:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ttq4EMyuxZH4gR3snahvG9mS+RZZGVQP8tvhh9PZxYUO/hnjLSoRnnhrbGc7bB05KmHKR X-Received: by 2002:a17:907:749:b0:782:3e85:97c4 with SMTP id xc9-20020a170907074900b007823e8597c4mr18482699ejb.446.1664201345948; Mon, 26 Sep 2022 07:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664201345; cv=none; d=google.com; s=arc-20160816; b=GeQtrEekQwVy4V7IKDMA5oEY6whcTtwXFa1YSZvL8DUE4Lvp/MQJ/FWyGXpJ0QrQ4D OFGHpgqZJGQDLMxKZzRIitpRmUvfprGZsS9/4jd+82W7/w2xuoxwkQn6REzKfgYmhQ9z EFr2W0BHCZT+9uxowtCx4nRtMzUMXTLzoPB2KfE8OYMw6mPIekWdwPl/RU7mAxucrzN7 oRMRziHG/9Cg62GSCY/u/Y8lQaEN/M4SqI0bIVIfUfWPFQEHmQDClTcKK0qITwkMQmda V63wKPrT0etTB2sOA8Q4SAkvrdwjsyVxqx8hvYiJf0R5kYGUVlVEdhAnt49y7Bur01iO R4Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gfqMRwvAXxGSZBUkcwljofCTesLeb/H9OmhG/I4F9JY=; b=FaP3cvBGiE9nsdVuEfoPObfGJaZcHpqUMFQoVyRG0n3TC1ugPPCELx2cpl7gMbFksu qKqPYrtbwldPlz/pTdw9e0/zKe2OwPcnISpCpi7cNJdE2jiwDFKKRwuziNrMCqKSKXg2 IZ1UgJF00LBEUHTe73m52VDlLWO+L8m6fvZrdm4fQeawhrVGfEOzMfxw0k693fF4PUn5 GDpQqvP4IhtsBZ1joSBPETWsbyAhhYx9kPCR6kkrcfsTWaB9+8mTIyE8t5FSLx3vSTC3 G03EHMesJJizCoaZNcnuNQLDOts7lutbwninLzpXKV0Cy57xnmvdWGEBgxmZAyAfqVAA ElrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v25K6Bi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa16-20020a1709076d1000b0073d68aa36d2si14861893ejc.667.2022.09.26.07.08.17; Mon, 26 Sep 2022 07:09:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v25K6Bi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238687AbiIZLqx (ORCPT + 99 others); Mon, 26 Sep 2022 07:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238568AbiIZLoC (ORCPT ); Mon, 26 Sep 2022 07:44:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E03B72844; Mon, 26 Sep 2022 03:46:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D2B0B8085B; Mon, 26 Sep 2022 10:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97706C433C1; Mon, 26 Sep 2022 10:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189186; bh=UwzIwLl/LbNa756QIwWB/0/t/ekD+jEtKmOLe+CjEkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v25K6Bi+26tWMVllpmVpUcyYE3PymCUnTlPwjGSnwMfHiGcAYh/qwEI/bE+37K+Iv 4rQgEW5yTON5JoBQ6zchQInie4RkTtLa3wnLoPYzZisjapD3sQjc8Mk5BPVHzS5Hq3 1LELy/XbJUiqclHqGvX5IszLhA0/WIhU+kr4+F5M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shigeru Yoshida , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 5.19 070/207] batman-adv: Fix hang up with small MTU hard-interface Date: Mon, 26 Sep 2022 12:10:59 +0200 Message-Id: <20220926100809.727360886@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shigeru Yoshida [ Upstream commit b1cb8a71f1eaec4eb77051590f7f561f25b15e32 ] The system hangs up when batman-adv soft-interface is created on hard-interface with small MTU. For example, the following commands create batman-adv soft-interface on dummy interface with zero MTU: # ip link add name dummy0 type dummy # ip link set mtu 0 dev dummy0 # ip link set up dev dummy0 # ip link add name bat0 type batadv # ip link set dev dummy0 master bat0 These commands cause the system hang up with the following messages: [ 90.578925][ T6689] batman_adv: bat0: Adding interface: dummy0 [ 90.580884][ T6689] batman_adv: bat0: The MTU of interface dummy0 is too small (0) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem. [ 90.586264][ T6689] batman_adv: bat0: Interface activated: dummy0 [ 90.590061][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320) [ 90.595517][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320) [ 90.598499][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320) This patch fixes this issue by returning error when enabling hard-interface with small MTU size. Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol") Signed-off-by: Shigeru Yoshida Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin --- net/batman-adv/hard-interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index b8f8da7ee3de..41c1ad33d009 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -700,6 +701,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, int max_header_len = batadv_max_header_len(); int ret; + if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len) + return -EINVAL; + if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) goto out; -- 2.35.1