[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <381e1bb7-111a-4af0-94ca-eef6b3423aca@amd.com>
Date: Tue, 7 May 2024 15:31:18 -0700
From: "Nelson, Shannon" <shannon.nelson@....com>
To: Eric Dumazet <edumazet@...gle.com>, "David S . Miller"
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com,
Simon Horman <horms@...nel.org>
Subject: Re: [PATCH net-next] net: annotate writes on dev->mtu from
ndo_change_mtu()
On 5/6/2024 3:28 AM, Eric Dumazet wrote:
>
> Simon reported that ndo_change_mtu() methods were never
> updated to use WRITE_ONCE(dev->mtu, new_mtu) as hinted
> in commit 501a90c94510 ("inet: protect against too small
> mtu values.")
>
> We read dev->mtu without holding RTNL in many places,
> with READ_ONCE() annotations.
>
> It is time to take care of ndo_change_mtu() methods
> to use corresponding WRITE_ONCE()
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Reported-by: Simon Horman <horms@...nel.org>
> Closes: https://lore.kernel.org/netdev/20240505144608.GB67882@kernel.org/
> ---
[...]
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 7f0c6cdc375e3686fb870739067b7faa712ed565..24870da3f4848857d2d6012ed82c78d2f031f7a1 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -1761,13 +1761,13 @@ static int ionic_change_mtu(struct net_device *netdev, int new_mtu)
>
> /* if we're not running, nothing more to do */
> if (!netif_running(netdev)) {
> - netdev->mtu = new_mtu;
> + WRITE_ONCE(netdev->mtu, new_mtu);
> return 0;
> }
>
> mutex_lock(&lif->queue_lock);
> ionic_stop_queues_reconfig(lif);
> - netdev->mtu = new_mtu;
> + WRITE_ONCE(netdev->mtu, new_mtu);
> err = ionic_start_queues_reconfig(lif);
> mutex_unlock(&lif->queue_lock);
Acked-by: Shannon Nelson <shannon.nelson@....com>
Powered by blists - more mailing lists