提交 d84cef15 编写于 作者: E Eric Dumazet 提交者: Zheng Zengkai

net: bridge: fix under estimation in br_get_linkxstats_size()

stable inclusion
from stable-5.10.73
commit 60955b65bd6a7dca624dd36c9a77b3326a6851a6
bugzilla: 182983 https://gitee.com/openeuler/kernel/issues/I4I3M0

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=60955b65bd6a7dca624dd36c9a77b3326a6851a6

--------------------------------

[ Upstream commit 0854a051 ]

Commit de179966 ("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: de179966 ("net: bridge: add STP xstats")
Signed-off-by: NEric Dumazet <edumazet@google.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Nikolay Aleksandrov <nikolay@nvidia.com>
Acked-by: NNikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 34f30d59
...@@ -1591,6 +1591,7 @@ static size_t br_get_linkxstats_size(const struct net_device *dev, int attr) ...@@ -1591,6 +1591,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)) + return numvls * nla_total_size(sizeof(struct bridge_vlan_xstats)) +
nla_total_size_64bit(sizeof(struct br_mcast_stats)) + nla_total_size_64bit(sizeof(struct br_mcast_stats)) +
(p ? nla_total_size_64bit(sizeof(p->stp_xstats)) : 0) +
nla_total_size(0); nla_total_size(0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册