diff options
author | 2020-10-21 10:00:53 +0800 | |
---|---|---|
committer | 2020-10-21 18:24:08 -0700 | |
commit | ebfe3c5183733f784264450a41646a482f964e5e (patch) | |
tree | bd86f2a5823a70d137f0aec26d196d9f3fe0dfbf /include | |
parent | net: ethernet: mtk-star-emac: select REGMAP_MMIO (diff) | |
download | linux-ebfe3c5183733f784264450a41646a482f964e5e.tar.gz linux-ebfe3c5183733f784264450a41646a482f964e5e.tar.bz2 linux-ebfe3c5183733f784264450a41646a482f964e5e.zip |
rtnetlink: fix data overflow in rtnl_calcit()
"ip addr show" command execute error when we have a physical
network card with a large number of VFs
The return value of if_nlmsg_size() in rtnl_calcit() will exceed
range of u16 data type when any network cards has a larger number of
VFs. rtnl_vfinfo_size() will significant increase needed dump size when
the value of num_vfs is larger.
Eventually we get a wrong value of min_ifinfo_dump_size because of overflow
which decides the memory size needed by netlink dump and netlink_dump()
will return -EMSGSIZE because of not enough memory was allocated.
So fix it by promoting min_dump_alloc data type to u32 to
avoid whole netlink message size overflow and it's also align
with the data type of struct netlink_callback{}.min_dump_alloc
which is assigned by return value of rtnl_calcit()
Signed-off-by: Di Zhu <zhudi21@huawei.com>
Link: https://lore.kernel.org/r/20201021020053.1401-1-zhudi21@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netlink.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 666cd0390699..9f118771e248 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -240,7 +240,7 @@ struct netlink_dump_control { int (*done)(struct netlink_callback *); void *data; struct module *module; - u16 min_dump_alloc; + u32 min_dump_alloc; }; int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |