mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 02:36:21 +00:00
rtnetlink: do not depend on RTNL for IFLA_QDISC output
dev->qdisc can be read using RCU protection. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
25010156d2
commit
698419ffb6
@ -1832,7 +1832,6 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
|
||||
if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid))
|
||||
goto nla_put_failure;
|
||||
|
||||
qdisc = rtnl_dereference(dev->qdisc);
|
||||
if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||
|
||||
nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) ||
|
||||
nla_put_u8(skb, IFLA_OPERSTATE,
|
||||
@ -1857,8 +1856,6 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
|
||||
#endif
|
||||
put_master_ifindex(skb, dev) ||
|
||||
nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||
|
||||
(qdisc &&
|
||||
nla_put_string(skb, IFLA_QDISC, qdisc->ops->id)) ||
|
||||
nla_put_ifalias(skb, dev) ||
|
||||
nla_put_u32(skb, IFLA_CARRIER_CHANGES,
|
||||
atomic_read(&dev->carrier_up_count) +
|
||||
@ -1924,6 +1921,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
|
||||
goto nla_put_failure;
|
||||
|
||||
rcu_read_lock();
|
||||
qdisc = rcu_dereference(dev->qdisc);
|
||||
if (qdisc && nla_put_string(skb, IFLA_QDISC, qdisc->ops->id))
|
||||
goto nla_put_failure_rcu;
|
||||
if (rtnl_fill_link_af(skb, dev, ext_filter_mask))
|
||||
goto nla_put_failure_rcu;
|
||||
if (rtnl_fill_link_ifmap(skb, dev))
|
||||
|
Loading…
x
Reference in New Issue
Block a user