]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: Return error on unknown encap_type in init_state
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 5 Jan 2018 11:12:32 +0000 (22:12 +1100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 8 Jan 2018 06:17:52 +0000 (07:17 +0100)
commit2606b1df5306bf570bce597785c7e8d4beb4c085
treea444825e0d2b435030057d0995533c25ca8e4f0b
parent531c835aa8c588a33627229f8b15d3c6374b04e2
xfrm: Return error on unknown encap_type in init_state

Currently esp will happily create an xfrm state with an unknown
encap type for IPv4, without setting the necessary state parameters.
This patch fixes it by returning -EINVAL.

There is a similar problem in IPv6 where if the mode is unknown
we will skip initialisation while returning zero.  However, this
is harmless as the mode has already been checked further up the
stack.  This patch removes this anomaly by aligning the IPv6
behaviour with IPv4 and treating unknown modes (which cannot
actually happen) as transport mode.

Fixes: bc05f2f12e16 ("[IPSEC]: Use crypto_aead and authenc in ESP")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv4/esp4.c
net/ipv6/esp6.c