]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfrm: Forbid state updates from changing encap type
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 26 Dec 2017 06:34:44 +0000 (17:34 +1100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Sat, 30 Dec 2017 08:18:47 +0000 (09:18 +0100)
commit257a4b018d1b514a1cc738e3ca11b566d8f3a3d8
treeb86e12edd8a20956c7e139fd754ba7adcebaf3c6
parent2758b3e3e630ba304fc4aca434d591e70e528298
xfrm: Forbid state updates from changing encap type

Currently we allow state updates to competely replace the contents
of x->encap.  This is bad because on the user side ESP only sets up
header lengths depending on encap_type once when the state is first
created.  This could result in the header lengths getting out of
sync with the actual state configuration.

In practice key managers will never do a state update to change the
encapsulation type.  Only the port numbers need to be changed as the
peer NAT entry is updated.

Therefore this patch adds a check in xfrm_state_update to forbid
any changes to the encap_type.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_state.c