Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1247567pxb; Fri, 22 Jan 2021 10:29:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwk/CAvwHX3xKi6+S/rWOPErO8B0gtr1VsOUfdJhKJJmD3+k3W04gS9x6FGksbLSx0vSOJp X-Received: by 2002:a17:906:cc89:: with SMTP id oq9mr3799454ejb.154.1611340164849; Fri, 22 Jan 2021 10:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611340164; cv=none; d=google.com; s=arc-20160816; b=TgYhJgg2eAAafLwyJ8ACO8NzTNEQJguQ3EYHZ2lhY/5h+4j8fzsfOC7Ihj/auTnjHk bAKWHEDTVPLElSADo3MF6j0fMlcifwYl45pjIkoQZypkbkFQXdNRttEBdMpRPMPICEoY QWaGArlPOyyR1uVsAJAH3rUMYZcAwhFgjsFgXhJys8u1RVtmSi80ozC2p2Iarvlwjcq4 M6Aj8O4FVCGwbBQiUEceM7KgDYu0Cz4tZ/muiflUQJvIOegrzvjaLYd1zxoEq2iqLOfk f70Qeo1bG61+w6dKQ2X4Dxe5b28Ju/WcwC7B/9YvYcOCVB3087I4H2c+mF5bRKlU8rjF Qydw== 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=JPIf9ljLLFYlblSGEgSQ68IBCkEWhbdmYDtA3zTKXUc=; b=RLnrun8ROzNwUIO1F68PV/DvTqjW/iWg5UZlkeZhGDVzQhWejeiFemHZ6cOYgFyfNq S/vaFbTnHjmc23nvUXIQFxMy1T8Q7uGHqp2XnLL5/OvoZQTalTIF1Lb+d6GzxFC2pqii KFmjt27GQawuvcMDN7uzCFWiC3Uve2tyddvYR1g9kolWXH8rytfBkUfmMhHYASFLTHy7 Uh7yOdYkw2gWBUdMUuK9TnFLt0ijJ2yEKvUnIjl22JFP3qq7UElN2D6x1SZ2Ig0WrnMl l2y7jFZ7Zk9B2FtQXqrObwJ6SbWJQ7YT5pgZS8pnysyq2E8awyj1dhMR/pbiOsINRqd6 LLBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=anK0qsIq; 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 au24si1967152ejc.265.2021.01.22.10.29.00; Fri, 22 Jan 2021 10:29:24 -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=anK0qsIq; 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 S1728812AbhAVS0G (ORCPT + 99 others); Fri, 22 Jan 2021 13:26:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:40028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbhAVOXB (ORCPT ); Fri, 22 Jan 2021 09:23:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8975C239EE; Fri, 22 Jan 2021 14:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611325036; bh=LUdd2E/cGjfP4Rbh63w81R58a6kR9vtbz624oz/ZfNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=anK0qsIqFN3HWRsvX8ez8YKFhPBmWRg6gl/eBXBtKz4P7C0i+cAI5qZOm2Zxbd1Hz Ya+JsRmjPQyPzAHKuW2lJDIfkrsN5L1+mtZNmU8tw+WYv/Or40oXjICpB1aWyNjY5x VliWaOHwyzF4ZL6pY209jNtX6aAn5qHJV09zHlC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Wu , Jakub Kicinski Subject: [PATCH 5.4 25/33] net: stmmac: Fixed mtu channged by cache aligned Date: Fri, 22 Jan 2021 15:12:41 +0100 Message-Id: <20210122135734.597944250@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135733.565501039@linuxfoundation.org> References: <20210122135733.565501039@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 @@ -3739,6 +3739,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; @@ -3756,7 +3757,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);