[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0bfded05-d4d1-4b60-a3fa-24a2ff6644b5@intel.com>
Date: Mon, 6 May 2024 15:31:10 -0700
From: Jacob Keller <jacob.e.keller@...el.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/
> ---
Many drivers, but it is fairly mechanical and straight forward. I
noticed one place where you also fixed up the code style, but otherwise
everything looks exactly like a mechanical transformation.
> diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> index 7b7e1c5b00f4728cccfb693e2ab4e32b9613616e..b7d9657a7af3d168ea6fa6acd205d690fc79db06 100644
> --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> @@ -3036,11 +3036,11 @@ static int myri10ge_change_mtu(struct net_device *dev, int new_mtu)
> /* if we change the mtu on an active device, we must
> * reset the device so the firmware sees the change */
> myri10ge_close(dev);
> - dev->mtu = new_mtu;
> + WRITE_ONCE(dev->mtu, new_mtu);
> myri10ge_open(dev);
> - } else
> - dev->mtu = new_mtu;
> -
Looks like you also fix up the style with { } here. That is fine with me.
> + } else {
> + WRITE_ONCE(dev->mtu, new_mtu);
> + }
> return 0;
> }
>
The new style is correct, and I see no reason not to commit this now and
fix up the writes.
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Powered by blists - more mailing lists