]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
xfrm: Reject optional tunnel/BEET mode templates in outbound policies
authorTobias Brunner <tobias@strongswan.org>
Tue, 9 May 2023 08:59:58 +0000 (10:59 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 9 Aug 2023 09:38:00 +0000 (11:38 +0200)
commit3db5f59ed14bb8f5925ae01e80f25ae977a68784
tree2317b42fdcdd7e5c47549344ec1805196c589f32
parentf9789bb74591b4cdd4ef8bb88934d7aefb030e49
xfrm: Reject optional tunnel/BEET mode templates in outbound policies

BugLink: https://bugs.launchpad.net/bugs/2028808
[ Upstream commit 3d776e31c841ba2f69895d2255a49320bec7cea6 ]

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: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Tobias Brunner <tobias@strongswan.org>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/xfrm/xfrm_user.c