Skip to contentSkip to conversation

Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0"

PATCH Applied [email protected] 3 participants 4 messages Mar 3, 2022 – Mar 14, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0"

From: Kai Lueke <[email protected]>

This reverts commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 because ID 0 was meant to be used for configuring the policy/state without matching for a specific interface (e.g., Cilium is affected, see
https://github.com/cilium/cilium/pull/18789 and
https://github.com/cilium/cilium/pull/19019).

---
 net/xfrm/xfrm_user.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
net/xfrm/xfrm_user.c +3 -18
index 8cd6c8129004..be89a8ac54a4 100644
@@ -630,13 +630,8 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
 
 	xfrm_smark_init(attrs, &x->props.smark);
 
-	if (attrs[XFRMA_IF_ID]) {
+	if (attrs[XFRMA_IF_ID])
 		x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
-		if (!x->if_id) {
-			err = -EINVAL;
-			goto error;
-		}
-	}
 
 	err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]);
 	if (err)
@@ -1432,13 +1427,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	mark = xfrm_mark_get(attrs, &m);
 
-	if (attrs[XFRMA_IF_ID]) {
+	if (attrs[XFRMA_IF_ID])
 		if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
-		if (!if_id) {
-			err = -EINVAL;
-			goto out_noput;
-		}
-	}
 
 	if (p->info.seq) {
 		x = xfrm_find_acq_byseq(net, mark, p->info.seq);
@@ -1751,13 +1741,8 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us
 
 	xfrm_mark_get(attrs, &xp->mark);
 
-	if (attrs[XFRMA_IF_ID]) {
+	if (attrs[XFRMA_IF_ID])
 		xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
-		if (!xp->if_id) {
-			err = -EINVAL;
-			goto error;
-		}
-	}
 
 	return xp;
  error:
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 9 lines · On Thu, Mar 03, 2022 at 03:55:10PM +0100, [email protected] wrote:

From: Kai Lueke <[email protected]>

This reverts commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 because ID 0 was meant to be used for configuring the policy/state without matching for a specific interface (e.g., Cilium is affected, see
https://github.com/cilium/cilium/pull/18789 and
https://github.com/cilium/cilium/pull/19019).

Applied, thanks Kai!

author
#2 lore raw

I forgot to CC stable@ when submitting, doing it now:
Can this be picked for the next round of stable kernels (down to 5.10)?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3d9001b4e287fc043e5539d03d71a32ab114bcb

Thanks,
Kai

Quoted 11 lines · Steffen Klassert
Quoted 9 lines · On Thu, Mar 03, 2022 at 03:55:10PM +0100, [email protected] wrote:

From: Kai Lueke <[email protected]>

This reverts commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 because ID 0 was meant to be used for configuring the policy/state without matching for a specific interface (e.g., Cilium is affected, see
https://github.com/cilium/cilium/pull/18789 and
https://github.com/cilium/cilium/pull/19019).

Applied, thanks Kai!

maintainer
#3 lore raw
Quoted 4 lines · Kai Lueke

I forgot to CC stable@ when submitting, doing it now:
Can this be picked for the next round of stable kernels (down to 5.10)?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3d9001b4e287fc043e5539d03d71a32ab114bcb

Quoted 15 lines

Thanks,
Kai

Quoted 11 lines · Steffen Klassert
Quoted 9 lines · On Thu, Mar 03, 2022 at 03:55:10PM +0100, [email protected] wrote:

From: Kai Lueke <[email protected]>

This reverts commit 68ac0f3810e76a853b5f7b90601a05c3048b8b54 because ID 0 was meant to be used for configuring the policy/state without matching for a specific interface (e.g., Cilium is affected, see
https://github.com/cilium/cilium/pull/18789 and
https://github.com/cilium/cilium/pull/19019).

Applied, thanks Kai!

I will pick it up for the next round of releases after these go out.

thanks,

greg k-h