aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/net/bpf_jit_comp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-12-10 15:48:20 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-10 15:48:20 -0500
commit22f10923dd39141785273e423b9acf347297e15f (patch)
treecc1f19103817433a426b3e329d6326f5e9d8e8f7 /arch/x86/net/bpf_jit_comp.c
parent785c20a08bead1e58ad53f2dc324782da7a0c9ea (diff)
parent69204cf7eb9c5a72067ce6922d4699378251d053 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/amd/xgbe/xgbe-desc.c drivers/net/ethernet/renesas/sh_eth.c Overlapping changes in both conflict cases. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/x86/net/bpf_jit_comp.c')
-rw-r--r--arch/x86/net/bpf_jit_comp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 626e01377a01..987514396c1e 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -178,7 +178,7 @@ static void jit_fill_hole(void *area, unsigned int size)
178} 178}
179 179
180struct jit_context { 180struct jit_context {
181 unsigned int cleanup_addr; /* epilogue code offset */ 181 int cleanup_addr; /* epilogue code offset */
182 bool seen_ld_abs; 182 bool seen_ld_abs;
183}; 183};
184 184
@@ -192,6 +192,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
192 struct bpf_insn *insn = bpf_prog->insnsi; 192 struct bpf_insn *insn = bpf_prog->insnsi;
193 int insn_cnt = bpf_prog->len; 193 int insn_cnt = bpf_prog->len;
194 bool seen_ld_abs = ctx->seen_ld_abs | (oldproglen == 0); 194 bool seen_ld_abs = ctx->seen_ld_abs | (oldproglen == 0);
195 bool seen_exit = false;
195 u8 temp[BPF_MAX_INSN_SIZE + BPF_INSN_SAFETY]; 196 u8 temp[BPF_MAX_INSN_SIZE + BPF_INSN_SAFETY];
196 int i; 197 int i;
197 int proglen = 0; 198 int proglen = 0;
@@ -854,10 +855,11 @@ common_load:
854 goto common_load; 855 goto common_load;
855 856
856 case BPF_JMP | BPF_EXIT: 857 case BPF_JMP | BPF_EXIT:
857 if (i != insn_cnt - 1) { 858 if (seen_exit) {
858 jmp_offset = ctx->cleanup_addr - addrs[i]; 859 jmp_offset = ctx->cleanup_addr - addrs[i];
859 goto emit_jmp; 860 goto emit_jmp;
860 } 861 }
862 seen_exit = true;
861 /* update cleanup_addr */ 863 /* update cleanup_addr */
862 ctx->cleanup_addr = proglen; 864 ctx->cleanup_addr = proglen;
863 /* mov rbx, qword ptr [rbp-X] */ 865 /* mov rbx, qword ptr [rbp-X] */