Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: bpf: Fix stack space allocation for BPF memwords on MIPS64

When allocating stack space for BPF memwords we need to use the
appropriate 32 or 64-bit instruction to avoid losing the top 32 bits
of the stack pointer.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <dborkman@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: netdev@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7135/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Markos Chandras and committed by
Ralf Baechle
d8214ef1 b6a14a98

+4 -1
+4 -1
arch/mips/net/bpf_jit.c
··· 623 623 if (ctx->flags & SEEN_MEM) { 624 624 if (real_off % (RSIZE * 2)) 625 625 real_off += RSIZE; 626 - emit_addiu(r_M, r_sp, real_off, ctx); 626 + if (config_enabled(CONFIG_64BIT)) 627 + emit_daddiu(r_M, r_sp, real_off, ctx); 628 + else 629 + emit_addiu(r_M, r_sp, real_off, ctx); 627 630 } 628 631 } 629 632