diff options
author | Eric Dumazet <edumazet@google.com> | 2024-05-07 21:41:44 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-05-09 04:51:30 +0300 |
commit | 8d8b1a422c4644891e1f8a3ea10b544b65cd0cc6 (patch) | |
tree | 93dbbadb3f9ac8e2befd101adb5d0ad1475c7a05 /drivers/net/ethernet/8390 | |
parent | e2d09e5a1e8fb17a807dc4dce8dbc39d9fea3788 (diff) | |
download | linux-8d8b1a422c4644891e1f8a3ea10b544b65cd0cc6.tar.xz |
net: annotate data-races around dev->if_port
Various ndo_set_config() methods can change dev->if_port
dev->if_port is going to be read locklessly from
rtnl_fill_link_ifmap().
Add corresponding WRITE_ONCE() on writer sides.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240507184144.1230469-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/8390')
-rw-r--r-- | drivers/net/ethernet/8390/etherh.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/8390/pcnet_cs.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/8390/etherh.c b/drivers/net/ethernet/8390/etherh.c index 05d39ecb97ff..e876fe52399a 100644 --- a/drivers/net/ethernet/8390/etherh.c +++ b/drivers/net/ethernet/8390/etherh.c @@ -258,7 +258,7 @@ static int etherh_set_config(struct net_device *dev, struct ifmap *map) * media type, turn off automedia detection. */ dev->flags &= ~IFF_AUTOMEDIA; - dev->if_port = map->port; + WRITE_ONCE(dev->if_port, map->port); break; default: diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c index 9bd5e991f1e5..780fb4afb6af 100644 --- a/drivers/net/ethernet/8390/pcnet_cs.c +++ b/drivers/net/ethernet/8390/pcnet_cs.c @@ -994,7 +994,7 @@ static int set_config(struct net_device *dev, struct ifmap *map) return -EOPNOTSUPP; else if ((map->port < 1) || (map->port > 2)) return -EINVAL; - dev->if_port = map->port; + WRITE_ONCE(dev->if_port, map->port); netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]); NS8390_init(dev, 1); } |