diff options
Diffstat (limited to 'arch/x86/net')
-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 | } |