net: limit altnames to 64k total
authorJakub Kicinski <kuba@kernel.org>
Wed, 9 Mar 2022 18:29:14 +0000 (10:29 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Mar 2022 04:15:23 +0000 (20:15 -0800)
commit155fb43b70b5fce341347a77d1af2765d1e8fbb8
treef2284583cd179aa85c97b4f0439c6af6d4414387
parent5d26cff5bdbebdf98ba48217c078ff102536f134
net: limit altnames to 64k total

Property list (altname is a link "property") is wrapped
in a nlattr. nlattrs length is 16bit so practically
speaking the list of properties can't be longer than
that, otherwise user space would have to interpret
broken netlink messages.

Prevent the problem from occurring by checking the length
of the property list before adding new entries.

Reported-by: George Shuklin <george.shuklin@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/rtnetlink.c