aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorGravatar Eric Dumazet <edumazet@google.com> 2024-05-03 19:20:54 +0000
committerGravatar Paolo Abeni <pabeni@redhat.com> 2024-05-07 11:14:50 +0200
commitad13b5b0d1f9eb8e048394919e6393e520b14552 (patch)
tree015b7013ba36f347ae850663d60e138853635254 /net/core
parentrtnetlink: do not depend on RTNL for IFLA_IFNAME output (diff)
downloadlinux-ad13b5b0d1f9eb8e048394919e6393e520b14552.tar.gz
linux-ad13b5b0d1f9eb8e048394919e6393e520b14552.tar.bz2
linux-ad13b5b0d1f9eb8e048394919e6393e520b14552.zip
rtnetlink: do not depend on RTNL for IFLA_TXQLEN output
rtnl_fill_ifinfo() can read dev->tx_queue_len locklessly, granted we add corresponding READ_ONCE()/WRITE_ONCE() annotations. Add missing READ_ONCE(dev->tx_queue_len) in teql_enqueue() Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/rtnetlink.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index d6b24749eb2e..882ce6375b2e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8959,7 +8959,7 @@ int dev_change_tx_queue_len(struct net_device *dev, unsigned long new_len)
return -ERANGE;
if (new_len != orig_len) {
- dev->tx_queue_len = new_len;
+ WRITE_ONCE(dev->tx_queue_len, new_len);
res = call_netdevice_notifiers(NETDEV_CHANGE_TX_QUEUE_LEN, dev);
res = notifier_to_errno(res);
if (res)
@@ -8973,7 +8973,7 @@ int dev_change_tx_queue_len(struct net_device *dev, unsigned long new_len)
err_rollback:
netdev_err(dev, "refused to change device tx_queue_len\n");
- dev->tx_queue_len = orig_len;
+ WRITE_ONCE(dev->tx_queue_len, orig_len);
return res;
}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index eb1a151c6910..7e156f535bd8 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1837,7 +1837,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
if (nla_put_string(skb, IFLA_IFNAME, devname))
goto nla_put_failure;
- if (nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) ||
+ if (nla_put_u32(skb, IFLA_TXQLEN, READ_ONCE(dev->tx_queue_len)) ||
nla_put_u8(skb, IFLA_OPERSTATE,
netif_running(dev) ? dev->operstate : IF_OPER_DOWN) ||
nla_put_u8(skb, IFLA_LINKMODE, dev->link_mode) ||