提交 1eeb7478 编写于 作者: H Heiko Carstens 提交者: Martin Schwidefsky

s390/bpf,jit: call module_free() from any context

The workqueue workaround is no longer needed. Same as 5199dfe5
"sparc: bpf_jit_comp: can call module_free() from any context".
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 dae7fd42
...@@ -772,8 +772,7 @@ void bpf_jit_compile(struct sk_filter *fp) ...@@ -772,8 +772,7 @@ void bpf_jit_compile(struct sk_filter *fp)
} else if (jit.prg == cjit.prg && jit.lit == cjit.lit) { } else if (jit.prg == cjit.prg && jit.lit == cjit.lit) {
prg_len = jit.prg - jit.start; prg_len = jit.prg - jit.start;
lit_len = jit.lit - jit.mid; lit_len = jit.lit - jit.mid;
size = max_t(unsigned long, prg_len + lit_len, size = prg_len + lit_len;
sizeof(struct work_struct));
if (size >= BPF_SIZE_MAX) if (size >= BPF_SIZE_MAX)
goto out; goto out;
jit.start = module_alloc(size); jit.start = module_alloc(size);
...@@ -804,21 +803,8 @@ void bpf_jit_compile(struct sk_filter *fp) ...@@ -804,21 +803,8 @@ void bpf_jit_compile(struct sk_filter *fp)
kfree(addrs); kfree(addrs);
} }
static void jit_free_defer(struct work_struct *arg)
{
module_free(NULL, arg);
}
/* run from softirq, we must use a work_struct to call
* module_free() from process context
*/
void bpf_jit_free(struct sk_filter *fp) void bpf_jit_free(struct sk_filter *fp)
{ {
struct work_struct *work; if (fp->bpf_func != sk_run_filter)
module_free(NULL, fp->bpf_func);
if (fp->bpf_func == sk_run_filter)
return;
work = (struct work_struct *)fp->bpf_func;
INIT_WORK(work, jit_free_defer);
schedule_work(work);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册