]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfrm: add missing extack for XFRMA_SA_PCPU in add_acquire and allocspi
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 23 Feb 2026 23:05:11 +0000 (00:05 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 25 Feb 2026 08:11:04 +0000 (09:11 +0100)
We're returning an error caused by invalid user input without setting
an extack. Add one.

Fixes: 1ddf9916ac09 ("xfrm: Add support for per cpu xfrm state handling.")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_user.c

index 403b5ecac2c544111b0c2b3268d288c76d7aea81..3e6477c6082e731ed4dc9c0c5435700bd1301007 100644 (file)
@@ -1850,6 +1850,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
                pcpu_num = nla_get_u32(attrs[XFRMA_SA_PCPU]);
                if (pcpu_num >= num_possible_cpus()) {
                        err = -EINVAL;
+                       NL_SET_ERR_MSG(extack, "pCPU number too big");
                        goto out_noput;
                }
        }
@@ -3001,8 +3002,10 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (attrs[XFRMA_SA_PCPU]) {
                x->pcpu_num = nla_get_u32(attrs[XFRMA_SA_PCPU]);
                err = -EINVAL;
-               if (x->pcpu_num >= num_possible_cpus())
+               if (x->pcpu_num >= num_possible_cpus()) {
+                       NL_SET_ERR_MSG(extack, "pCPU number too big");
                        goto free_state;
+               }
        }
 
        err = verify_newpolicy_info(&ua->policy, extack);