ARM: net fix emit_udiv() for BPF_ALU | BPF_DIV | BPF_K intruction.
authorNicolas Schichan <nschichan@freebox.fr>
Wed, 6 May 2015 16:31:56 +0000 (18:31 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Tue, 9 Jun 2015 17:43:31 +0000 (13:43 -0400)
commit4e5279e4493ddf627a33e838b8aec103f8f75f0f
tree1aa254cc59ba9ac94a6dba0eb24474e490532ce1
parent7b022b8ad207d2d0ce8aa8a16d22a424a417f28d
ARM: net fix emit_udiv() for BPF_ALU | BPF_DIV | BPF_K intruction.

[ Upstream commit 19fc99d0c6ba7d9b65456496b5bb2169d5f74cd0 ]

In that case, emit_udiv() will be called with rn == ARM_R0 (r_scratch)
and loading rm first into ARM_R0 will result in jit_udiv() function
being called the same dividend and divisor. Fix that by loading rn
first into ARM_R1 and then rm into ARM_R0.

Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
Cc: <stable@vger.kernel.org> # v3.13+
Fixes: aee636c4809f (bpf: do not use reciprocal divide)
Acked-by: Mircea Gherzan <mgherzan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/arm/net/bpf_jit_32.c