ppc: bpf_jit: can call module_free() from any context
Subsystems (7)
PATCH 1/2 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.
--- arch/powerpc/net/bpf_jit_comp.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
arch/powerpc/net/bpf_jit_comp.c +3 -16
@@ -650,8 +650,7 @@ void bpf_jit_compile(struct sk_filter *fp) proglen = cgctx.idx *4 ; alloclen = proglen +FUNCTION_DESCR_SIZE ; - image = module_alloc(max_t(unsigned int, alloclen, -sizeof (struct work_struct ))); + image =module_alloc (alloclen);if (!image) goto out;
@@ -688,20 +687,8 @@ out:return ; } -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) { -if (fp->bpf_func != sk_run_filter) { -struct work_struct *work = (struct work_struct *)fp->bpf_func; - -INIT_WORK (work, jit_free_defer); -schedule_work (work); - } +if (fp->bpf_func != sk_run_filter) +module_free (NULL , fp->bpf_func); }
Signature · 1 line
1.7.11.7
PATCH 2/2 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.
--- arch/arm/net/bpf_jit_32.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
arch/arm/net/bpf_jit_32.c +3 -15
@@ -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;
@@ -927,19 +926,8 @@ out: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); }
Signature · 1 line
1.7.11.7
Re: [PATCH net-next 2/2] arm: bpf_jit: can call module_free() from any context
From: Daniel Borkmann <[email protected]>
Date: Mon, 20 May 2013 20:05:51 +0200
Quoted 4 lines
Follow-up on module_free()/vfree() that takes care of the rest, so no longer this workaround with
work_structneeded.Signed-off-by Daniel Borkmann <[email protected]>
Applied.
From: Daniel Borkmann <[email protected]>
Date: Mon, 20 May 2013 20:05:50 +0200
Quoted 4 lines
Followup patch on module_free()/vfree() that takes care of the rest, so no longer this workaround with
work_structis needed.Signed-off-by Daniel Borkmann <[email protected]>
Applied.