Skip to content

Commit

Permalink
netfilter: x_tables: xt_free_table_info() cleanup
Browse files Browse the repository at this point in the history
kvfree() helper can make xt_free_table_info() much cleaner.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Eric Dumazet authored and Pablo Neira Ayuso committed Jun 25, 2014
1 parent 397304b commit f6b5082
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions net/netfilter/x_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,28 +711,15 @@ void xt_free_table_info(struct xt_table_info *info)
{
int cpu;

for_each_possible_cpu(cpu) {
if (info->size <= PAGE_SIZE)
kfree(info->entries[cpu]);
else
vfree(info->entries[cpu]);
}
for_each_possible_cpu(cpu)
kvfree(info->entries[cpu]);

if (info->jumpstack != NULL) {
if (sizeof(void *) * info->stacksize > PAGE_SIZE) {
for_each_possible_cpu(cpu)
vfree(info->jumpstack[cpu]);
} else {
for_each_possible_cpu(cpu)
kfree(info->jumpstack[cpu]);
}
for_each_possible_cpu(cpu)
kvfree(info->jumpstack[cpu]);
kvfree(info->jumpstack);
}

if (sizeof(void **) * nr_cpu_ids > PAGE_SIZE)
vfree(info->jumpstack);
else
kfree(info->jumpstack);

free_percpu(info->stackptr);

kfree(info);
Expand Down

0 comments on commit f6b5082

Please sign in to comment.