Skip to content

Commit 8a0661f

Browse files
committed
netfilter: nf_tables: set element extended ACK reporting support
jira VULN-430 cve-pre CVE-2023-4244 commit-author Pablo Neira Ayuso <pablo@netfilter.org> commit b53c116 Report the element that causes problems via netlink extended ACK for set element commands. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit b53c116) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent 6ae8fd3 commit 8a0661f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5571,8 +5571,10 @@ static int nf_tables_getsetelem(struct sk_buff *skb,
55715571

55725572
nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
55735573
err = nft_get_set_elem(&ctx, set, attr);
5574-
if (err < 0)
5574+
if (err < 0) {
5575+
NL_SET_BAD_ATTR(extack, attr);
55755576
break;
5577+
}
55765578
}
55775579

55785580
return err;
@@ -6401,8 +6403,10 @@ static int nf_tables_newsetelem(struct sk_buff *skb,
64016403

64026404
nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
64036405
err = nft_add_set_elem(&ctx, set, attr, info->nlh->nlmsg_flags);
6404-
if (err < 0)
6406+
if (err < 0) {
6407+
NL_SET_BAD_ATTR(extack, attr);
64056408
return err;
6409+
}
64066410
}
64076411

64086412
if (nft_net->validate_state == NFT_VALIDATE_DO)
@@ -6674,8 +6678,10 @@ static int nf_tables_delsetelem(struct sk_buff *skb,
66746678

66756679
nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
66766680
err = nft_del_setelem(&ctx, set, attr);
6677-
if (err < 0)
6681+
if (err < 0) {
6682+
NL_SET_BAD_ATTR(extack, attr);
66786683
break;
6684+
}
66796685
}
66806686
return err;
66816687
}

0 commit comments

Comments
 (0)