Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4823769ybl; Wed, 22 Jan 2020 05:26:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwC/rXKxVLe2r8QVeGA9WzntlJcRDCEEKqmLUxHjQAEy6g2qX/fxARrqftOHcR0YL7QNp+d X-Received: by 2002:a05:6830:2361:: with SMTP id r1mr7056839oth.88.1579699563578; Wed, 22 Jan 2020 05:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699563; cv=none; d=google.com; s=arc-20160816; b=jehRqbnLxQqmHoRJYSITu9i5PKze2E2qV7oPvR/66nxYtIQ9YOdcK63IPa5c65yIeW 0io6Q1MRW9TbQxaD/Aff4CjyVxX0jxLI7PCCyj9f80miWeaAmPeew8UNIHiqD3mvrYBX Vhh64kwE/Dp53hslp189hhKM7eYTP2o1QkWGEKgCJipSGa+wBtdoSPT0Yrl/rv6uOyFS MzzLullUK5YhoWMfCZxDd/UjPLiFCkRErjTfni5kia5tV/nrPuYtIAQLoOtvA3JzcBLB LnWcU5zORgZRHcikxr+wJxn6V+p+qY/oBSKmM1SC+jDYEBbHW4VYy0PrTz9TbKL1l9e7 s/1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=88/WXWHn65VqMm23GXajw1L6Yd/4qHj2zct2Zt6EYpQ=; b=LJ7gR7gOAS7Qli95vw1R36+qstBepm7Qb0Ki+y6ZhfLs5F+cw+fhVmfNMpgHjOVOzE rlUqh9Kwke4+khpqvKce63PVlo0jmqPhYH4DftJEvMu3Mnt+Z9+bPscIx6d0PaVa49cF NHkp8BfvI3DW8ep1KEfQXSybWrUrhOs8B8pwNMAF85Wzvti4G67XhGB9M/TdTG135K0o L83T0IFxDIzRaLO6Kj44ErkQxA572wjRJH5GSQVbsQoD2Yd4DTri1y5dv2elUA2dhXad Zrrs2wvUG8PTqD5Kd3yQ1v7BXsS0dOzsPsTvSRHq39LVD4QpyI83oTWC01FNXe31ppHT PlvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TWeJYeO/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si24280350otl.74.2020.01.22.05.25.52; Wed, 22 Jan 2020 05:26:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TWeJYeO/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730542AbgAVNYB (ORCPT + 99 others); Wed, 22 Jan 2020 08:24:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:42624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730155AbgAVNYA (ORCPT ); Wed, 22 Jan 2020 08:24:00 -0500 Received: from localhost (unknown [84.241.205.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 625DA2467B; Wed, 22 Jan 2020 13:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699440; bh=0QjlQtTTabmc9LN4ALwyRXkbHB9NqZWvRyzB4ypdrNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWeJYeO/IOqPGKY6K6ZJR+2k2pGHBXopcjMbGQqeQjscwavr2+Nq8CqXF3VSnaFYw BxaJEk+nDmitdDXFo3s97/8aMWQG2Vn5+aJxH9IGMkwFfoLI/8bUDl9bFnQCmsa/Ry K5rkABRubipKunmlkCBuQ7DBQtFzQWQVoCOkZCzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , RENARD Pierre-Francois , Stefan Wahren , Woojung Huh , Microchip Linux Driver Support , "David S. Miller" Subject: [PATCH 5.4 144/222] net: usb: lan78xx: limit size of local TSO packets Date: Wed, 22 Jan 2020 10:28:50 +0100 Message-Id: <20200122092844.041982912@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet [ Upstream commit f8d7408a4d7f60f8b2df0f81decdc882dd9c20dc ] lan78xx_tx_bh() makes sure to not exceed MAX_SINGLE_PACKET_SIZE bytes in the aggregated packets it builds, but does nothing to prevent large GSO packets being submitted. Pierre-Francois reported various hangs when/if TSO is enabled. For localy generated packets, we can use netif_set_gso_max_size() to limit the size of TSO packets. Note that forwarded packets could still hit the issue, so a complete fix might require implementing .ndo_features_check for this driver, forcing a software segmentation if the size of the TSO packet exceeds MAX_SINGLE_PACKET_SIZE. Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Eric Dumazet Reported-by: RENARD Pierre-Francois Tested-by: RENARD Pierre-Francois Cc: Stefan Wahren Cc: Woojung Huh Cc: Microchip Linux Driver Support Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/lan78xx.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -3750,6 +3750,7 @@ static int lan78xx_probe(struct usb_inte /* MTU range: 68 - 9000 */ netdev->max_mtu = MAX_SINGLE_PACKET_SIZE; + netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1;