Skip to content

Commit 5c613a8

Browse files
pvts-matPlaidCat
authored andcommitted
netfilter: nf_tables: set backend .flush always succeeds
jira VULN-430 subsystem-update netfilter: centos-stream-9 cfd9694 commit-author Pablo Neira Ayuso <pablo@netfilter.org> commit 6509a2e .flush is always successful since this results from iterating over the set elements to toggle mark the element as inactive in the next generation. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit 6509a2e) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent 0251806 commit 5c613a8

File tree

6 files changed

+7
-23
lines changed

6 files changed

+7
-23
lines changed

include/net/netfilter/nf_tables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ struct nft_set_ops {
412412
void * (*deactivate)(const struct net *net,
413413
const struct nft_set *set,
414414
const struct nft_set_elem *elem);
415-
bool (*flush)(const struct net *net,
415+
void (*flush)(const struct net *net,
416416
const struct nft_set *set,
417417
void *priv);
418418
void (*remove)(const struct net *net,

net/netfilter/nf_tables_api.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6777,17 +6777,13 @@ static int nft_setelem_flush(const struct nft_ctx *ctx,
67776777
struct nft_set_elem *elem)
67786778
{
67796779
struct nft_trans *trans;
6780-
int err;
67816780

67826781
trans = nft_trans_alloc_gfp(ctx, NFT_MSG_DELSETELEM,
67836782
sizeof(struct nft_trans_elem), GFP_ATOMIC);
67846783
if (!trans)
67856784
return -ENOMEM;
67866785

6787-
if (!set->ops->flush(ctx->net, set, elem->priv)) {
6788-
err = -ENOENT;
6789-
goto err1;
6790-
}
6786+
set->ops->flush(ctx->net, set, elem->priv);
67916787
set->ndeact++;
67926788

67936789
nft_setelem_data_deactivate(ctx->net, set, elem);
@@ -6796,9 +6792,6 @@ static int nft_setelem_flush(const struct nft_ctx *ctx,
67966792
nft_trans_commit_list_add_tail(ctx->net, trans);
67976793

67986794
return 0;
6799-
err1:
6800-
kfree(trans);
6801-
return err;
68026795
}
68036796

68046797
static int __nft_set_catchall_flush(const struct nft_ctx *ctx,

net/netfilter/nft_set_bitmap.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static void nft_bitmap_activate(const struct net *net,
174174
nft_set_elem_change_active(net, set, &be->ext);
175175
}
176176

177-
static bool nft_bitmap_flush(const struct net *net,
177+
static void nft_bitmap_flush(const struct net *net,
178178
const struct nft_set *set, void *_be)
179179
{
180180
struct nft_bitmap *priv = nft_set_priv(set);
@@ -186,8 +186,6 @@ static bool nft_bitmap_flush(const struct net *net,
186186
/* Enter 10 state, similar to deactivation. */
187187
priv->bitmap[idx] &= ~(genmask << off);
188188
nft_set_elem_change_active(net, set, &be->ext);
189-
190-
return true;
191189
}
192190

193191
static void *nft_bitmap_deactivate(const struct net *net,

net/netfilter/nft_set_hash.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,12 @@ static void nft_rhash_activate(const struct net *net, const struct nft_set *set,
192192
nft_set_elem_change_active(net, set, &he->ext);
193193
}
194194

195-
static bool nft_rhash_flush(const struct net *net,
195+
static void nft_rhash_flush(const struct net *net,
196196
const struct nft_set *set, void *priv)
197197
{
198198
struct nft_rhash_elem *he = priv;
199199

200200
nft_set_elem_change_active(net, set, &he->ext);
201-
202-
return true;
203201
}
204202

205203
static void *nft_rhash_deactivate(const struct net *net,
@@ -590,13 +588,12 @@ static void nft_hash_activate(const struct net *net, const struct nft_set *set,
590588
nft_set_elem_change_active(net, set, &he->ext);
591589
}
592590

593-
static bool nft_hash_flush(const struct net *net,
591+
static void nft_hash_flush(const struct net *net,
594592
const struct nft_set *set, void *priv)
595593
{
596594
struct nft_hash_elem *he = priv;
597595

598596
nft_set_elem_change_active(net, set, &he->ext);
599-
return true;
600597
}
601598

602599
static void *nft_hash_deactivate(const struct net *net,

net/netfilter/nft_set_pipapo.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,14 +1811,12 @@ static void *nft_pipapo_deactivate(const struct net *net,
18111811
*
18121812
* Return: true if element was found and deactivated.
18131813
*/
1814-
static bool nft_pipapo_flush(const struct net *net, const struct nft_set *set,
1814+
static void nft_pipapo_flush(const struct net *net, const struct nft_set *set,
18151815
void *elem)
18161816
{
18171817
struct nft_pipapo_elem *e = elem;
18181818

18191819
nft_set_elem_change_active(net, set, &e->ext);
1820-
1821-
return true;
18221820
}
18231821

18241822
/**

net/netfilter/nft_set_rbtree.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,12 @@ static void nft_rbtree_activate(const struct net *net,
530530
nft_set_elem_change_active(net, set, &rbe->ext);
531531
}
532532

533-
static bool nft_rbtree_flush(const struct net *net,
533+
static void nft_rbtree_flush(const struct net *net,
534534
const struct nft_set *set, void *priv)
535535
{
536536
struct nft_rbtree_elem *rbe = priv;
537537

538538
nft_set_elem_change_active(net, set, &rbe->ext);
539-
540-
return true;
541539
}
542540

543541
static void *nft_rbtree_deactivate(const struct net *net,

0 commit comments

Comments
 (0)