]> git.itanic.dy.fi Git - linux-stable/commit
net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr
authorAlex Henrie <alexhenrie24@gmail.com>
Fri, 1 Sep 2023 04:41:27 +0000 (22:41 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 08:47:02 +0000 (10:47 +0200)
commitd66e729add6c554d594982f8a34348985f28f2bd
tree49ec1423adb9a818ea60412952e61551f1e7427a
parent93e7fbc2f9a67effe79242906b3e0e1095cc08d7
net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr

[ Upstream commit f31867d0d9d82af757c1e0178b659438f4c1ea3c ]

The existing code incorrectly casted a negative value (the result of a
subtraction) to an unsigned value without checking. For example, if
/proc/sys/net/ipv6/conf/*/temp_prefered_lft was set to 1, the preferred
lifetime would jump to 4 billion seconds. On my machine and network the
shortest lifetime that avoided underflow was 3 seconds.

Fixes: 76506a986dc3 ("IPv6: fix DESYNC_FACTOR")
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/addrconf.c