Skip to content

Commit 650c849

Browse files
edumazetdavem330
authored andcommitted
x86: bpf_jit_comp: can call module_free() from any context
It looks like we can call module_free()/vfree() from softirq context, so no longer need a wrapper and a work_struct. Signed-off-by: Eric Dumazet <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b4236da commit 650c849

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

arch/x86/net/bpf_jit_comp.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -717,9 +717,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
717717
break;
718718
}
719719
if (proglen == oldproglen) {
720-
image = module_alloc(max_t(unsigned int,
721-
proglen,
722-
sizeof(struct work_struct)));
720+
image = module_alloc(proglen);
723721
if (!image)
724722
goto out;
725723
}
@@ -738,20 +736,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
738736
return;
739737
}
740738

741-
static void jit_free_defer(struct work_struct *arg)
742-
{
743-
module_free(NULL, arg);
744-
}
745-
746-
/* run from softirq, we must use a work_struct to call
747-
* module_free() from process context
748-
*/
749739
void bpf_jit_free(struct sk_filter *fp)
750740
{
751-
if (fp->bpf_func != sk_run_filter) {
752-
struct work_struct *work = (struct work_struct *)fp->bpf_func;
753-
754-
INIT_WORK(work, jit_free_defer);
755-
schedule_work(work);
756-
}
741+
if (fp->bpf_func != sk_run_filter)
742+
module_free(NULL, fp->bpf_func);
757743
}

0 commit comments

Comments
 (0)