Skip to content

Commit aa8a3f3

Browse files
qsnklassert
authored andcommitted
xfrm: add missing extack for XFRMA_SA_PCPU in add_acquire and allocspi
We're returning an error caused by invalid user input without setting an extack. Add one. Fixes: 1ddf991 ("xfrm: Add support for per cpu xfrm state handling.") Signed-off-by: Sabrina Dubroca <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 2f61f38 commit aa8a3f3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

net/xfrm/xfrm_user.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
18501850
pcpu_num = nla_get_u32(attrs[XFRMA_SA_PCPU]);
18511851
if (pcpu_num >= num_possible_cpus()) {
18521852
err = -EINVAL;
1853+
NL_SET_ERR_MSG(extack, "pCPU number too big");
18531854
goto out_noput;
18541855
}
18551856
}
@@ -3001,8 +3002,10 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
30013002
if (attrs[XFRMA_SA_PCPU]) {
30023003
x->pcpu_num = nla_get_u32(attrs[XFRMA_SA_PCPU]);
30033004
err = -EINVAL;
3004-
if (x->pcpu_num >= num_possible_cpus())
3005+
if (x->pcpu_num >= num_possible_cpus()) {
3006+
NL_SET_ERR_MSG(extack, "pCPU number too big");
30053007
goto free_state;
3008+
}
30063009
}
30073010

30083011
err = verify_newpolicy_info(&ua->policy, extack);

0 commit comments

Comments
 (0)