History

Merge tag 'nf-24-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf

Pablo Neira Ayuso says: ==================== Netfilter fixes for net The following patchset contains Netfilter fixes for net. There is a larger batch of fixes still pending that will follow up asap, this is what I deemed to be more urgent at this time: 1) Use clone view in pipapo set backend to release elements from destroy path, otherwise it is possible to destroy elements twice. 2) Incorrect check for internal table flags lead to bogus transaction objects. 3) Fix counters memleak in netdev basechain update error path, from Quan Tian. netfilter pull request 24-03-21 * tag 'nf-24-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf: netfilter: nf_tables: Fix a memory leak in nf_tables_updchain netfilter: nf_tables: do not compare internal table flags on updates netfilter: nft_set_pipapo: release elements in clone only from destroy path ====================

Paolo Abeni committed 2 years ago

Commit f99c5f52 parents f411e25 7eaf8372 files · +16 −18Browse files

Unified · Split

2 files
  1. net/netfilter/nf_tables_api.c +15 −14
  2. net/netfilter/nft_set_pipapo.c +1 −4
net/netfilter/nf_tables_api.c+15−14
@@ -1213,7 +1213,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx) · 1212 unmodified lines
12131213 if (flags & ~NFT_TABLE_F_MASK)
12141214 return -EOPNOTSUPP;
12151215
1216− if (flags == ctx->table->flags)
1216+ if (flags == (ctx->table->flags & NFT_TABLE_F_MASK))
12171217 return 0;
12181218
12191219 if ((nft_table_has_owner(ctx->table) &&
@@ -2631,19 +2631,6 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 1411 unmodified lines
26312631 }
26322632 }
26332633
2634− if (nla[NFTA_CHAIN_COUNTERS]) {
2635− if (!nft_is_base_chain(chain)) {
2636− err = -EOPNOTSUPP;
2637− goto err_hooks;
2638− }
2639−
2640− stats = nft_stats_alloc(nla[NFTA_CHAIN_COUNTERS]);
2641− if (IS_ERR(stats)) {
2642− err = PTR_ERR(stats);
2643− goto err_hooks;
2644− }
2645− }
2646−
26472634 if (!(table->flags & NFT_TABLE_F_DORMANT) &&
26482635 nft_is_base_chain(chain) &&
26492636 !list_empty(&hook.list)) {
@@ -2658,6 +2645,20 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 8 unmodified lines
26582645 }
26592646
26602647 unregister = true;
2648+
2649+ if (nla[NFTA_CHAIN_COUNTERS]) {
2650+ if (!nft_is_base_chain(chain)) {
2651+ err = -EOPNOTSUPP;
2652+ goto err_hooks;
2653+ }
2654+
2655+ stats = nft_stats_alloc(nla[NFTA_CHAIN_COUNTERS]);
2656+ if (IS_ERR(stats)) {
2657+ err = PTR_ERR(stats);
2658+ goto err_hooks;
2659+ }
2660+ }
2661+
26612662 err = -ENOMEM;
26622663 trans = nft_trans_alloc(ctx, NFT_MSG_NEWCHAIN,
26632664 sizeof(struct nft_trans_chain));
net/netfilter/nft_set_pipapo.c+1−4
@@ -2329,8 +2329,6 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx, · 2328 unmodified lines
23292329 if (m) {
23302330 rcu_barrier();
23312331
2332− nft_set_pipapo_match_destroy(ctx, set, m);
2333−
23342332 for_each_possible_cpu(cpu)
23352333 pipapo_free_scratch(m, cpu);
23362334 free_percpu(m->scratch);
@@ -2342,8 +2340,7 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx, · 5 unmodified lines
23422340 if (priv->clone) {
23432341 m = priv->clone;
23442342
2345− if (priv->dirty)
2346− nft_set_pipapo_match_destroy(ctx, set, m);
2343+ nft_set_pipapo_match_destroy(ctx, set, m);
23472344
23482345 for_each_possible_cpu(cpu)
23492346 pipapo_free_scratch(priv->clone, cpu);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t