s390/bpf: Fix branch shortening during codegen pass
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 7 Sep 2021 09:58:59 +0000 (11:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:28:02 +0000 (12:28 +0200)
commitab7cf225016159bc2c3590be6fa12965565d903b
tree4c3667103d50c97624a0d846064e2c381e53a014
parent4320c222c2ffe778a8aff5b8bc4ac33af6d54eba
s390/bpf: Fix branch shortening during codegen pass

commit 1511df6f5e9ef32826f20db2ee81f8527154dc14 upstream.

EMIT6_PCREL() macro assumes that the previous pass generated 6 bytes
of code, which is not the case if branch shortening took place. Fix by
using jit->prg, like all the other EMIT6_PCREL_*() macros.

Reported-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Fixes: 4e9b4a6883dd ("s390/bpf: Use relative long branches")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/net/bpf_jit_comp.c