diff options
author | Eric Dumazet <edumazet@google.com> | 2013-05-16 15:45:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-17 20:37:19 -0400 |
commit | 650c8496702f2910c506ccf66685893302e1796e (patch) | |
tree | a1236a98d13dfb56d2d6b020f1c06a0353b54dba /arch/x86 | |
parent | b4236daa410e4e778a938ac1151bf94d94c55efc (diff) |
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 <edumazet@google.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/net/bpf_jit_comp.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index f66b54086ce5..c0212db40032 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
@@ -717,9 +717,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i]; | |||
717 | break; | 717 | break; |
718 | } | 718 | } |
719 | if (proglen == oldproglen) { | 719 | if (proglen == oldproglen) { |
720 | image = module_alloc(max_t(unsigned int, | 720 | image = module_alloc(proglen); |
721 | proglen, | ||
722 | sizeof(struct work_struct))); | ||
723 | if (!image) | 721 | if (!image) |
724 | goto out; | 722 | goto out; |
725 | } | 723 | } |
@@ -738,20 +736,8 @@ out: | |||
738 | return; | 736 | return; |
739 | } | 737 | } |
740 | 738 | ||
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 | */ | ||
749 | void bpf_jit_free(struct sk_filter *fp) | 739 | void bpf_jit_free(struct sk_filter *fp) |
750 | { | 740 | { |
751 | if (fp->bpf_func != sk_run_filter) { | 741 | if (fp->bpf_func != sk_run_filter) |
752 | struct work_struct *work = (struct work_struct *)fp->bpf_func; | 742 | module_free(NULL, fp->bpf_func); |
753 | |||
754 | INIT_WORK(work, jit_free_defer); | ||
755 | schedule_work(work); | ||
756 | } | ||
757 | } | 743 | } |