[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221117115939.GI704954@gauss3.secunet.de>
Date: Thu, 17 Nov 2022 12:59:39 +0100
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Leon Romanovsky <leon@...nel.org>
CC: Leon Romanovsky <leonro@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Jakub Kicinski <kuba@...nel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH xfrm-next v7 4/8] xfrm: add TX datapath support for IPsec
packet offload mode
On Wed, Nov 09, 2022 at 02:54:32PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@...dia.com>
> @@ -2708,6 +2710,23 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
> if (!dev)
> goto free_dst;
>
> + dst1 = &xdst0->u.dst;
> + /* Packet offload: both policy and SA should be offloaded */
> + if ((policy->xdo.type == XFRM_DEV_OFFLOAD_PACKET &&
> + dst1->xfrm->xso.type != XFRM_DEV_OFFLOAD_PACKET) ||
> + (policy->xdo.type != XFRM_DEV_OFFLOAD_PACKET &&
> + dst1->xfrm->xso.type == XFRM_DEV_OFFLOAD_PACKET)) {
> + err = -EINVAL;
> + goto free_dst;
> + }
> +
> + /* Packet offload: both policy and SA should have same device */
> + if (policy->xdo.type == XFRM_DEV_OFFLOAD_PACKET &&
> + policy->xdo.dev != dst1->xfrm->xso.dev) {
> + err = -EINVAL;
> + goto free_dst;
> + }
> +
This is the wrong place for these checks. Things went already wrong
in the lookup if policy and state do not match here.
Powered by blists - more mailing lists