Skip to content

Commit ed900ff

Browse files
Daniel Borkmanndavem330
authored andcommitted
ppc: bpf_jit: can call module_free() from any context
Followup patch on module_free()/vfree() that takes care of the rest, so no longer this workaround with work_struct is needed. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Matt Evans <matt@ozlabs.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 71cea17 commit ed900ff

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,7 @@ void bpf_jit_compile(struct sk_filter *fp)
650650

651651
proglen = cgctx.idx * 4;
652652
alloclen = proglen + FUNCTION_DESCR_SIZE;
653-
image = module_alloc(max_t(unsigned int, alloclen,
654-
sizeof(struct work_struct)));
653+
image = module_alloc(alloclen);
655654
if (!image)
656655
goto out;
657656

@@ -688,20 +687,8 @@ void bpf_jit_compile(struct sk_filter *fp)
688687
return;
689688
}
690689

691-
static void jit_free_defer(struct work_struct *arg)
692-
{
693-
module_free(NULL, arg);
694-
}
695-
696-
/* run from softirq, we must use a work_struct to call
697-
* module_free() from process context
698-
*/
699690
void bpf_jit_free(struct sk_filter *fp)
700691
{
701-
if (fp->bpf_func != sk_run_filter) {
702-
struct work_struct *work = (struct work_struct *)fp->bpf_func;
703-
704-
INIT_WORK(work, jit_free_defer);
705-
schedule_work(work);
706-
}
692+
if (fp->bpf_func != sk_run_filter)
693+
module_free(NULL, fp->bpf_func);
707694
}

0 commit comments

Comments
 (0)