Commit ed900ffb authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller
Browse files

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: default avatarDaniel Borkmann <dborkman@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Matt Evans <matt@ozlabs.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 71cea17e
Loading
Loading
Loading
Loading
+3 −16
Original line number Original line Diff line number Diff line
@@ -650,8 +650,7 @@ void bpf_jit_compile(struct sk_filter *fp)


	proglen = cgctx.idx * 4;
	proglen = cgctx.idx * 4;
	alloclen = proglen + FUNCTION_DESCR_SIZE;
	alloclen = proglen + FUNCTION_DESCR_SIZE;
	image = module_alloc(max_t(unsigned int, alloclen,
	image = module_alloc(alloclen);
				   sizeof(struct work_struct)));
	if (!image)
	if (!image)
		goto out;
		goto out;


@@ -688,20 +687,8 @@ void bpf_jit_compile(struct sk_filter *fp)
	return;
	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)
void bpf_jit_free(struct sk_filter *fp)
{
{
	if (fp->bpf_func != sk_run_filter) {
	if (fp->bpf_func != sk_run_filter)
		struct work_struct *work = (struct work_struct *)fp->bpf_func;
		module_free(NULL, fp->bpf_func);

		INIT_WORK(work, jit_free_defer);
		schedule_work(work);
	}
}
}