Skip to content

Commit

Permalink
netfilter: nft_compat: use _safe version of list_for_each
Browse files Browse the repository at this point in the history
We need to use the _safe version of list_for_each_entry() here otherwise
we have a use after free bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Dan Carpenter authored and Pablo Neira Ayuso committed Nov 4, 2013
1 parent ca0e8bd commit c359c41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/netfilter/nft_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,9 @@ nft_match_select_ops(const struct nft_ctx *ctx,

static void nft_match_release(void)
{
struct nft_xt *nft_match;
struct nft_xt *nft_match, *tmp;

list_for_each_entry(nft_match, &nft_match_list, head)
list_for_each_entry_safe(nft_match, tmp, &nft_match_list, head)
kfree(nft_match);
}

Expand Down Expand Up @@ -705,9 +705,9 @@ nft_target_select_ops(const struct nft_ctx *ctx,

static void nft_target_release(void)
{
struct nft_xt *nft_target;
struct nft_xt *nft_target, *tmp;

list_for_each_entry(nft_target, &nft_target_list, head)
list_for_each_entry_safe(nft_target, tmp, &nft_target_list, head)
kfree(nft_target);
}

Expand Down

0 comments on commit c359c41

Please sign in to comment.