Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8214ef1 authored by Markos Chandras's avatar Markos Chandras Committed by Ralf Baechle
Browse files

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: default avatarMarkos 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: default avatarRalf Baechle <ralf@linux-mips.org>
parent b6a14a98
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -623,6 +623,9 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset)
	if (ctx->flags & SEEN_MEM) {
	if (ctx->flags & SEEN_MEM) {
		if (real_off % (RSIZE * 2))
		if (real_off % (RSIZE * 2))
			real_off += RSIZE;
			real_off += RSIZE;
		if (config_enabled(CONFIG_64BIT))
			emit_daddiu(r_M, r_sp, real_off, ctx);
		else
			emit_addiu(r_M, r_sp, real_off, ctx);
			emit_addiu(r_M, r_sp, real_off, ctx);
	}
	}
}
}