From: "Nelson, Shannon" <shannon.nelson@amd.com>
To: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com,
Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net-next] net: annotate writes on dev->mtu from ndo_change_mtu()
Date: Tue, 7 May 2024 15:31:18 -0700 [thread overview]
Message-ID: <381e1bb7-111a-4af0-94ca-eef6b3423aca@amd.com> (raw)
In-Reply-To: <20240506102812.3025432-1-edumazet@google.com>
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@google.com>
> Reported-by: Simon Horman <horms@kernel.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@amd.com>
next prev parent reply other threads:[~2024-05-07 22:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 10:28 [PATCH net-next] net: annotate writes on dev->mtu from ndo_change_mtu() Eric Dumazet
2024-05-06 22:31 ` Jacob Keller
2024-05-07 10:05 ` Sabrina Dubroca
2024-05-07 20:07 ` Simon Horman
2024-05-07 22:31 ` Nelson, Shannon [this message]
2024-05-07 23:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=381e1bb7-111a-4af0-94ca-eef6b3423aca@amd.com \
--to=shannon.nelson@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).