Skip to content

Commit

Permalink
netfilter: nf_tables: disallow timeout for anonymous sets
Browse files Browse the repository at this point in the history
jira VULN-429
subsystem-sync netfilter:nf_tables 4.18.0-511
commit-author Pablo Neira Ayuso <[email protected]>
commit e26d300

Never used from userspace, disallow these parameters.

    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    (cherry picked from commit e26d300)
    Signed-off-by: Greg Rose <[email protected]>
  • Loading branch information
gvrose8192 committed Oct 21, 2024
1 parent c1e7303 commit 22f98fe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -4164,6 +4164,10 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
if (nla[NFTA_SET_GC_INTERVAL] != NULL) {
if (!(flags & NFT_SET_TIMEOUT))
return -EINVAL;

if (flags & NFT_SET_ANONYMOUS)
return -EOPNOTSUPP;

gc_int = ntohl(nla_get_be32(nla[NFTA_SET_GC_INTERVAL]));
}

Expand Down Expand Up @@ -5342,6 +5346,10 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
if (nla[NFTA_SET_ELEM_TIMEOUT] != NULL) {
if (!(set->flags & NFT_SET_TIMEOUT))
return -EINVAL;

if (flags & NFT_SET_ANONYMOUS)
return -EOPNOTSUPP;

err = nf_msecs_to_jiffies64(nla[NFTA_SET_ELEM_TIMEOUT],
&timeout);
if (err)
Expand Down

0 comments on commit 22f98fe

Please sign in to comment.