Skip to content

Commit 27504b8

Browse files
ijwhitfieldmehmetb0
authored andcommitted
UBUNTU: SAUCE: netfilter: nf_tables: Fix EBUSY on deleting unreferenced chain
BugLink: https://bugs.launchpad.net/bugs/2089699 Our backport of upstream commit e79b47a introduced a bug in the reference counting of chains in nf_tables that resulted in some valid chain deletion transactions to fail with the error "Error: Could not process rule: Device or resource busy". This bug is not present in the upstream stable backport to linux-6.6.y, commit 164936b2fc88. To resolve the bug, this commit modifies our backport to match commit 164936b2fc88883341fe7a2d9c42b69020e5cafd in linux-6.6.y Fixes: 08950d7 ("netfilter: nf_tables: restore set elements when delete set fails") Signed-off-by: Ian Whitfield <ian.whitfield@canonical.com> Acked-by: Magali Lemes <magali.lemes@canonical.com> Acked-by: Jacob Martin <jacob.martin@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent f58115e commit 27504b8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ static int nft_mapelem_deactivate(const struct nft_ctx *ctx,
594594
const struct nft_set_iter *iter,
595595
struct nft_set_elem *elem)
596596
{
597-
struct nft_set_ext *ext = nft_set_elem_ext(set, elem);
597+
struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
598598

599599
if (!nft_set_elem_active(ext, iter->genmask))
600600
return 0;
@@ -5040,7 +5040,7 @@ static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
50405040
const struct nft_set_iter *iter,
50415041
struct nft_set_elem *elem)
50425042
{
5043-
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem);
5043+
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
50445044

50455045
if (!nft_set_elem_active(ext, iter->genmask))
50465046
return 0;
@@ -5139,7 +5139,7 @@ static int nft_mapelem_activate(const struct nft_ctx *ctx,
51395139
const struct nft_set_iter *iter,
51405140
struct nft_set_elem *elem)
51415141
{
5142-
struct nft_set_ext *ext = nft_set_elem_ext(set, elem);
5142+
struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
51435143

51445144
/* called from abort path, reverse check to undo changes. */
51455145
if (nft_set_elem_active(ext, iter->genmask))
@@ -5164,8 +5164,8 @@ static void nft_map_catchall_activate(const struct nft_ctx *ctx,
51645164
if (!nft_set_elem_active(ext, genmask))
51655165
continue;
51665166

5167-
elem.priv = catchall->elem;
51685167
nft_clear(ctx->net, ext);
5168+
elem.priv = catchall->elem;
51695169
nft_setelem_data_activate(ctx->net, set, &elem);
51705170
break;
51715171
}
@@ -6799,7 +6799,7 @@ static int nft_setelem_flush(const struct nft_ctx *ctx,
67996799
const struct nft_set_iter *iter,
68006800
struct nft_set_elem *elem)
68016801
{
6802-
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem);
6802+
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
68036803
struct nft_trans *trans;
68046804
int err;
68056805

net/netfilter/nft_set_pipapo.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,6 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set,
20732073

20742074
e = f->mt[r].e;
20752075

2076-
20772076
elem.priv = e;
20782077

20792078
iter->err = iter->fn(ctx, set, iter, &elem);

0 commit comments

Comments
 (0)