Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1265262pxb; Fri, 22 Jan 2021 10:58:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVZo3v4LvYiuAJ63xzZPhwvOwClJnzVKkm1fn1PM5lC7HKxyf/BKFfiv+icqLWKvao+L5f X-Received: by 2002:a17:906:1bf2:: with SMTP id t18mr4100655ejg.166.1611341894238; Fri, 22 Jan 2021 10:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611341894; cv=none; d=google.com; s=arc-20160816; b=CA5xF4mnS5Pol4vpFmsj8tYZrZyYGNZklPJyhgg6xNvYQWSvWK4XQFV7ON2uojhnsM Gnu2i6+ARBIfDl77vXbIZYXspYxvdj4XA1sz6+SU/AgKC647MzQ+Gv46C5YqXC+6BV/E 8kFVqvxl7kuNNI21A9/3Y6ATDZca9unuOk8svcU7HIS5FM+7lZZqGpXonYxHaDz7wmjk zbjyTaNoIWbVwoob+yppCbNTPhMutz/A5lE0KaoiWWlojEJ1sC88JhSbl/IaFYmQi50n dbup+kJKNoMlBiW1YGsw7vfA5Azk+2y/Sklpxy935SOhhAa2J65XjLn727EsE227drCV 7keA== 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=zamPQ4PEBKSHvO6jRPjKWf+xRe4oVfO3MbTg2aDdx9I=; b=FElYpp4TkyhNUdzwlJZQ4SnSwyTrvXKkBYdsU8uNoGk4yDFKwl5h4GPh0HCiYOSEws XqTokCo3Ba/hoJcgOcU290dV9MAVf+dvegKtjzcdjGKuAHHWH1B7Ei5byKZfkRfJT9oT apmyBMOGZhcuT+AjB0VwlkI4ul5D2bywTKDxMTY/EnLpDvCNz65YulwgUSgKRjGtcRFU MabtC1GyF5/Bs0qPtDx5jKF+B2+bdTzk1js2JSvogG2w1z4APuezmox9fVJl5eagd3AY PPKaBxFPG+d5l8uxunnayqxPkj0sBLnvhycIHZaPd/GA8c2Tdqa3DLuwbUHb7gzRIVSZ vFVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cHoqlc7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn1si3793932edb.226.2021.01.22.10.57.49; Fri, 22 Jan 2021 10:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cHoqlc7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730213AbhAVSwq (ORCPT + 99 others); Fri, 22 Jan 2021 13:52:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:40016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728536AbhAVOWO (ORCPT ); Fri, 22 Jan 2021 09:22:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5AACC23B44; Fri, 22 Jan 2021 14:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324943; bh=emZyV+w6Pyo04tbdFelWtIQdvAqMn8EpXL0VU455U44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cHoqlc7V2gkPhJ1PRrrhrccpcj0fM9FyuFCXjPNIAf3YvlRLFc6KwblYFaraIAC6v ODszIaY+uvfp0gthDcC8Sco0sXRLtoaeGJHlawd8hOjdCDh/F2+5G1uCSt+QLRd/7V g8hACGvQ1OtlCrnRLD0Wmob6miq1nUs6j4aT17Zw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Wu , Jakub Kicinski Subject: [PATCH 4.19 14/22] net: stmmac: Fixed mtu channged by cache aligned Date: Fri, 22 Jan 2021 15:12:32 +0100 Message-Id: <20210122135732.476825547@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135731.921636245@linuxfoundation.org> References: <20210122135731.921636245@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: David Wu [ Upstream commit 5b55299eed78538cc4746e50ee97103a1643249c ] Since the original mtu is not used when the mtu is updated, the mtu is aligned with cache, this will get an incorrect. For example, if you want to configure the mtu to be 1500, but mtu 1536 is configured in fact. Fixed: eaf4fac478077 ("net: stmmac: Do not accept invalid MTU values") Signed-off-by: David Wu Link: https://lore.kernel.org/r/20210113034109.27865-1-david.wu@rock-chips.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3596,6 +3596,7 @@ static int stmmac_change_mtu(struct net_ { struct stmmac_priv *priv = netdev_priv(dev); int txfifosz = priv->plat->tx_fifo_size; + const int mtu = new_mtu; if (txfifosz == 0) txfifosz = priv->dma_cap.tx_fifo_size; @@ -3613,7 +3614,7 @@ static int stmmac_change_mtu(struct net_ if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) return -EINVAL; - dev->mtu = new_mtu; + dev->mtu = mtu; netdev_update_features(dev);