Skip to content

Commit aafc787

Browse files
Daniel Borkmanndavem330
authored andcommitted
arm: bpf_jit: can call module_free() from any context
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>
1 parent ed900ff commit aafc787

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

arch/arm/net/bpf_jit_32.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,7 @@ void bpf_jit_compile(struct sk_filter *fp)
900900
#endif
901901

902902
alloc_size = 4 * ctx.idx;
903-
ctx.target = module_alloc(max(sizeof(struct work_struct),
904-
alloc_size));
903+
ctx.target = module_alloc(alloc_size);
905904
if (unlikely(ctx.target == NULL))
906905
goto out;
907906

@@ -927,19 +926,8 @@ void bpf_jit_compile(struct sk_filter *fp)
927926
return;
928927
}
929928

930-
static void bpf_jit_free_worker(struct work_struct *work)
931-
{
932-
module_free(NULL, work);
933-
}
934-
935929
void bpf_jit_free(struct sk_filter *fp)
936930
{
937-
struct work_struct *work;
938-
939-
if (fp->bpf_func != sk_run_filter) {
940-
work = (struct work_struct *)fp->bpf_func;
941-
942-
INIT_WORK(work, bpf_jit_free_worker);
943-
schedule_work(work);
944-
}
931+
if (fp->bpf_func != sk_run_filter)
932+
module_free(NULL, fp->bpf_func);
945933
}

0 commit comments

Comments
 (0)