Commit f9432f37 authored by Tobias Brunner's avatar Tobias Brunner Committed by sanglipeng
Browse files

af_key: Reject optional tunnel/BEET mode templates in outbound policies

stable inclusion
from stable-v5.10.181
commit 8f57715f8ef6afd75e0d10e70bc970489907e548
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8GJZJ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8f57715f8ef6afd75e0d10e70bc970489907e548



--------------------------------

[ Upstream commit cf3128a7 ]

xfrm_state_find() uses `encap_family` of the current template with
the passed local and remote addresses to find a matching state.
If an optional tunnel or BEET mode template is skipped in a mixed-family
scenario, there could be a mismatch causing an out-of-bounds read as
the addresses were not replaced to match the family of the next template.

While there are theoretical use cases for optional templates in outbound
policies, the only practical one is to skip IPComp states in inbound
policies if uncompressed packets are received that are handled by an
implicitly created IPIP state instead.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarTobias Brunner <tobias@strongswan.org>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent e4cbfc87
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment