Searched hist:ebfe3c5183733f784264450a41646a482f964e5e (Results 1 – 2 of 2) sorted by relevance
/openbmc/linux/include/linux/ |
H A D | netlink.h | diff ebfe3c5183733f784264450a41646a482f964e5e Tue Oct 20 21:00:53 CDT 2020 Di Zhu <zhudi21@huawei.com> 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>
|
/openbmc/linux/net/core/ |
H A D | rtnetlink.c | diff ebfe3c5183733f784264450a41646a482f964e5e Tue Oct 20 21:00:53 CDT 2020 Di Zhu <zhudi21@huawei.com> 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>
|