xfrm: Fix wraparound in xfrm_policy_addr_delta()
stable inclusion from stable-5.10.13 commit 6daa52884c3fd8f534b7ebfd784111cea69daa9d bugzilla: 47995 -------------------------------- [ Upstream commit da64ae2d ] Use three-way comparison for address components to avoid integer wraparound in the result of xfrm_policy_addr_delta(). This ensures that the search trees are built and traversed correctly. Treat IPv4 and IPv6 similarly by returning 0 when prefixlen == 0. Prefix /0 has only one equivalence class. Fixes: 9cf545eb ("xfrm: policy: store inexact policies in a tree ordered by destination address") Signed-off-by: NVisa Hankala <visa@hankala.org> Acked-by: NFlorian Westphal <fw@strlen.de> Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com> Signed-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com> Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Showing
想要评论请 注册 或 登录