Repository : ssh://git@diktynna/batman-adv On branches: main,main
commit 8f27a9c14e0a9ba1ba1c8499eb703595646dce8b Author: Eric Dumazet edumazet@google.com Date: Mon May 6 10:28:12 2024 +0000
batman-adv: annotate writes on dev->mtu from ndo_change_mtu()
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/ Reviewed-by: Jacob Keller jacob.e.keller@intel.com Reviewed-by: Sabrina Dubroca sd@queasysnail.net Reviewed-by: Simon Horman horms@kernel.org Acked-by: Shannon Nelson shannon.nelson@amd.com Link: https://lore.kernel.org/r/20240506102812.3025432-1-edumazet@google.com Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: Sven Eckelmann sven@narfation.org
8f27a9c14e0a9ba1ba1c8499eb703595646dce8b net/batman-adv/soft-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 89c51b3c..30ecbc2e 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -159,7 +159,7 @@ static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu) if (new_mtu < ETH_MIN_MTU || new_mtu > batadv_hardif_min_mtu(dev)) return -EINVAL;
- dev->mtu = new_mtu; + WRITE_ONCE(dev->mtu, new_mtu); bat_priv->mtu_set_by_user = new_mtu;
return 0;