summaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-10-05 03:05:08 +0200
committerDavid S. Miller <davem@davemloft.net>2021-10-05 13:39:07 +0200
commit0854a0513321cf70bea5fa483ebcaa983cc7c62e (patch)
tree7b0069b5ff26774c06cbda2b48515aed3f762ae1 /net/bridge
parentnet: bridge: use nla_total_size_64bit() in br_get_linkxstats_size() (diff)
downloadlinux-0854a0513321cf70bea5fa483ebcaa983cc7c62e.tar.xz
linux-0854a0513321cf70bea5fa483ebcaa983cc7c62e.zip
net: bridge: fix under estimation in br_get_linkxstats_size()
Commit de1799667b00 ("net: bridge: add STP xstats") added an additional nla_reserve_64bit() in br_fill_linkxstats(), but forgot to update br_get_linkxstats_size() accordingly. This can trigger the following in rtnl_stats_get() WARN_ON(err == -EMSGSIZE); Fixes: de1799667b00 ("net: bridge: add STP xstats") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Vivien Didelot <vivien.didelot@gmail.com> Cc: Nikolay Aleksandrov <nikolay@nvidia.com> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_netlink.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 29b8f6373fb9..5c6c4305ed23 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1667,6 +1667,7 @@ static size_t br_get_linkxstats_size(const struct net_device *dev, int attr)
return numvls * nla_total_size(sizeof(struct bridge_vlan_xstats)) +
nla_total_size_64bit(sizeof(struct br_mcast_stats)) +
+ (p ? nla_total_size_64bit(sizeof(p->stp_xstats)) : 0) +
nla_total_size(0);
}