xfrm: Fix xfrm sel prefix length validation
authorAnirudh Gupta <anirudhrudr@gmail.com>
Tue, 21 May 2019 15:29:47 +0000 (20:59 +0530)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 28 May 2019 07:16:30 +0000 (09:16 +0200)
commitb38ff4075a80b4da5cb2202d7965332ca0efb213
treece1c22930ec6d5226927d0befda04237ac5c94ca
parentaf8f3fb7fb077c9df9fed97113a031e792163def
xfrm: Fix xfrm sel prefix length validation

Family of src/dst can be different from family of selector src/dst.
Use xfrm selector family to validate address prefix length,
while verifying new sa from userspace.

Validated patch with this command:
ip xfrm state add src 1.1.6.1 dst 1.1.6.2 proto esp spi 4260196 \
reqid 20004 mode tunnel aead "rfc4106(gcm(aes))" \
0x1111016400000000000000000000000044440001 128 \
sel src 1011:1:4::2/128 sel dst 1021:1:4::2/128 dev Port5

Fixes: 07bf7908950a ("xfrm: Validate address prefix lengths in the xfrm selector.")
Signed-off-by: Anirudh Gupta <anirudh.gupta@sophos.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_user.c