[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201021183129.42d64f14@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 21 Oct 2020 18:31:29 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: zhudi <zhudi21@...wei.com>
Cc: <davem@...emloft.net>, <netdev@...r.kernel.org>,
<rose.chen@...wei.com>
Subject: Re: [PATCH v3] rtnetlink: fix data overflow in rtnl_calcit()
On Wed, 21 Oct 2020 10:00:53 +0800 zhudi wrote:
> From: Di Zhu <zhudi21@...wei.com>
>
> "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@...wei.com>
Applied, thanks!
Powered by blists - more mailing lists