diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-05-20 04:05:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-20 17:03:50 -0400 |
commit | aafc787e41fd8a4d3a4378b028d8d8f8d38d9bb6 (patch) | |
tree | 7b300d6c74c287f5e868d0dcf429a8078dca072d | |
parent | ed900ffb73e3ab154dff1ae20a2393f24da728df (diff) |
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>
-rw-r--r-- | arch/arm/net/bpf_jit_32.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 1a643ee8e082..f50d223a0bd3 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -900,8 +900,7 @@ void bpf_jit_compile(struct sk_filter *fp) | |||
900 | #endif | 900 | #endif |
901 | 901 | ||
902 | alloc_size = 4 * ctx.idx; | 902 | alloc_size = 4 * ctx.idx; |
903 | ctx.target = module_alloc(max(sizeof(struct work_struct), | 903 | ctx.target = module_alloc(alloc_size); |
904 | alloc_size)); | ||
905 | if (unlikely(ctx.target == NULL)) | 904 | if (unlikely(ctx.target == NULL)) |
906 | goto out; | 905 | goto out; |
907 | 906 | ||
@@ -927,19 +926,8 @@ out: | |||
927 | return; | 926 | return; |
928 | } | 927 | } |
929 | 928 | ||
930 | static void bpf_jit_free_worker(struct work_struct *work) | ||
931 | { | ||
932 | module_free(NULL, work); | ||
933 | } | ||
934 | |||
935 | void bpf_jit_free(struct sk_filter *fp) | 929 | void bpf_jit_free(struct sk_filter *fp) |
936 | { | 930 | { |
937 | struct work_struct *work; | 931 | if (fp->bpf_func != sk_run_filter) |
938 | 932 | module_free(NULL, fp->bpf_func); | |
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 | } | ||
945 | } | 933 | } |