Skip to content

Commit

Permalink
arm: bpf_jit: can call module_free() from any context
Browse files Browse the repository at this point in the history
Follow-up on module_free()/vfree() that takes care of the rest, so no
longer this workaround with work_struct needed.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Mircea Gherzan <mgherzan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed May 20, 2013
1 parent ed900ff commit aafc787
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions arch/arm/net/bpf_jit_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,7 @@ void bpf_jit_compile(struct sk_filter *fp)
#endif

alloc_size = 4 * ctx.idx;
ctx.target = module_alloc(max(sizeof(struct work_struct),
alloc_size));
ctx.target = module_alloc(alloc_size);
if (unlikely(ctx.target == NULL))
goto out;

Expand All @@ -927,19 +926,8 @@ void bpf_jit_compile(struct sk_filter *fp)
return;
}

static void bpf_jit_free_worker(struct work_struct *work)
{
module_free(NULL, work);
}

void bpf_jit_free(struct sk_filter *fp)
{
struct work_struct *work;

if (fp->bpf_func != sk_run_filter) {
work = (struct work_struct *)fp->bpf_func;

INIT_WORK(work, bpf_jit_free_worker);
schedule_work(work);
}
if (fp->bpf_func != sk_run_filter)
module_free(NULL, fp->bpf_func);
}

0 comments on commit aafc787

Please sign in to comment.