diff options
| author | Eric Dumazet <[email protected]> | 2024-05-06 10:28:12 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2024-05-07 23:19:14 +0000 |
| commit | 1eb2cded45b35816085c1f962933c187d970f9dc (patch) | |
| tree | 27a26692748d3c69fcd896a10db9bc89c1eb54b5 /drivers/net/netdevsim/netdev.c | |
| parent | net: dccp: Fix ccid2_rtt_estimator() kernel-doc (diff) | |
| download | kernel-1eb2cded45b35816085c1f962933c187d970f9dc.tar.gz kernel-1eb2cded45b35816085c1f962933c187d970f9dc.zip | |
net: 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 <[email protected]>
Reported-by: Simon Horman <[email protected]>
Closes: https://lore.kernel.org/netdev/[email protected]/
Reviewed-by: Jacob Keller <[email protected]>
Reviewed-by: Sabrina Dubroca <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Acked-by: Shannon Nelson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
| -rw-r--r-- | drivers/net/netdevsim/netdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index d127856f8f36..e3a385a32269 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -74,7 +74,7 @@ static int nsim_change_mtu(struct net_device *dev, int new_mtu) if (ns->xdp.prog && new_mtu > NSIM_XDP_MAX_MTU) return -EBUSY; - dev->mtu = new_mtu; + WRITE_ONCE(dev->mtu, new_mtu); return 0; } |
