diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index ab3d814bc80a..681d4d830f91 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -672,6 +672,7 @@ static int esp_init_state(struct xfrm_state *x) switch (encap->encap_type) { default: + err = -EINVAL; goto error; case UDP_ENCAP_ESPINUDP: x->props.header_len += sizeof(struct udphdr); diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 40ffd72243a4..7b9bb6062cf8 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -616,13 +616,12 @@ static int esp6_init_state(struct xfrm_state *x) x->props.header_len += IPV4_BEET_PHMAXLEN + (sizeof(struct ipv6hdr) - sizeof(struct iphdr)); break; + default: case XFRM_MODE_TRANSPORT: break; case XFRM_MODE_TUNNEL: x->props.header_len += sizeof(struct ipv6hdr); break; - default: - goto error; } align = ALIGN(crypto_aead_blocksize(aead), 4);