ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg
authorWang Yufen <wangyufen@huawei.com>
Tue, 7 Jun 2022 12:00:28 +0000 (20:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jun 2022 12:21:58 +0000 (14:21 +0200)
commit27a37755ceb401111ded76810359d3adc4b268a1
treec42a8039b7d8127c524a3b461cd39738c2f7c43a
parent6616872cfe7f0474a22dd1f12699f95bcf81a54d
ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg

[ Upstream commit f638a84afef3dfe10554c51820c16e39a278c915 ]

When len >= INT_MAX - transhdrlen, ulen = len + transhdrlen will be
overflow. To fix, we can follow what udpv6 does and subtract the
transhdrlen from the max.

Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Link: https://lore.kernel.org/r/20220607120028.845916-2-wangyufen@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/l2tp/l2tp_ip6.c