net: limit altnames to 64k total
authorJakub Kicinski <kuba@kernel.org>
Wed, 9 Mar 2022 18:29:14 +0000 (10:29 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Apr 2022 19:01:00 +0000 (21:01 +0200)
commit278b652f0ad9d34158d4834c6b00b95a808fd230
treec07cb5af5a83702203f3b134e62b0b9c579c8a7a
parent423e7107f61ff6dfd4b380efc68c5acfc2546e4c
net: limit altnames to 64k total

[ Upstream commit 155fb43b70b5fce341347a77d1af2765d1e8fbb8 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/rtnetlink.c