From patchwork Sun Oct 23 14:29:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Richter X-Patchwork-Id: 685538 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3t21yT5hncz9t9k for ; Mon, 24 Oct 2016 01:29:37 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755217AbcJWO3Z (ORCPT ); Sun, 23 Oct 2016 10:29:25 -0400 Received: from einhorn.in-berlin.de ([192.109.42.8]:56343 "EHLO einhorn.in-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754427AbcJWO3Y (ORCPT ); Sun, 23 Oct 2016 10:29:24 -0400 X-Envelope-From: stefanr@s5r6.in-berlin.de Received: from kant ([83.221.231.68]) (authenticated bits=0) by einhorn.in-berlin.de (8.14.4/8.14.4/Debian-8+deb8u1) with ESMTP id u9NET3WW008513 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2016 16:29:05 +0200 Date: Sun, 23 Oct 2016 16:29:03 +0200 From: Stefan Richter To: "David S. Miller" Cc: netdev@vger.kernel.org, linux1394-devel@lists.sourceforge.net, Jarod Wilson , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] firewire: net: fix maximum possible MTU Message-ID: <20161023162903.4166a35d@kant> In-Reply-To: <20161023011824.GE32569@redhat.com> References: <20161019023333.15760-1-jarod@redhat.com> <20161020175524.6184-1-jarod@redhat.com> <20161020175524.6184-8-jarod@redhat.com> <20161022211606.3b5d137d@kant> <20161022212759.228c7642@kant> <20161023011824.GE32569@redhat.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit b3e3893e1253 ("net: use core MTU range checking in misc drivers") mistakenly introduced an upper limit for firewire-net's MTU based on the local link layer controller's reception capability. Revert this. Neither RFC 2734 nor our implementation impose any particular upper limit. Actually, to be on the safe side and to make the code explicit, set ETH_MAX_MTU = 65535 as upper limit now. (I replaced sizeof(struct rfc2734_header) by the equivalent RFC2374_FRAG_HDR_SIZE in order to avoid distracting long/int conversions.) Fixes: b3e3893e1253('net: use core MTU range checking in misc drivers') CC: netdev@vger.kernel.org CC: linux1394-devel@lists.sourceforge.net CC: Jarod Wilson Signed-off-by: Stefan Richter Acked-by: Jarod Wilson --- drivers/firewire/net.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 8430222151fc..99379542b263 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -1467,10 +1467,11 @@ static int fwnet_probe(struct fw_unit *unit, * Use the RFC 2734 default 1500 octets or the maximum payload * as initial MTU */ - net->max_mtu = (1 << (card->max_receive + 1)) - - sizeof(struct rfc2734_header) - IEEE1394_GASP_HDR_SIZE; - net->mtu = min(1500U, net->max_mtu); + net->mtu = min(1500U, + (1U << (card->max_receive + 1)) + - RFC2374_FRAG_HDR_SIZE - IEEE1394_GASP_HDR_SIZE); net->min_mtu = ETH_MIN_MTU; + net->max_mtu = ETH_MAX_MTU; /* Set our hardware address while we're at it */ ha = (union fwnet_hwaddr *)net->dev_addr;