xfrm: enforce validity of offload input flags
authorLeon Romanovsky <leonro@nvidia.com>
Tue, 8 Feb 2022 14:14:32 +0000 (16:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:12:44 +0000 (19:12 +0100)
commit4020d2e14f13155fe1f2a7adeb19825210a5749e
tree7deadb9eb7c42e4450c5fbaed5c312782f7a5693
parentce0d6bf33c351e82f30d810da8a1e192b94faa03
xfrm: enforce validity of offload input flags

commit 7c76ecd9c99b6e9a771d813ab1aa7fa428b3ade1 upstream.

struct xfrm_user_offload has flags variable that received user input,
but kernel didn't check if valid bits were provided. It caused a situation
where not sanitized input was forwarded directly to the drivers.

For example, XFRM_OFFLOAD_IPV6 define that was exposed, was used by
strongswan, but not implemented in the kernel at all.

As a solution, check and sanitize input flags to forward
XFRM_OFFLOAD_INBOUND to the drivers.

Fixes: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/uapi/linux/xfrm.h
net/xfrm/xfrm_device.c