diff options
author | Hari Bathini <hbathini@linux.ibm.com> | 2023-04-25 12:28:29 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-24 17:30:23 +0100 |
commit | bc4f671161b6c3535b4b9e6fb6e408b064fb4f0f (patch) | |
tree | fbf6746a7e35413ef7c53ade52156e10070261cc /arch | |
parent | 4e913882a3719e7b56858abad8e79e73d346f46e (diff) | |
download | linux-stable-bc4f671161b6c3535b4b9e6fb6e408b064fb4f0f.tar.gz linux-stable-bc4f671161b6c3535b4b9e6fb6e408b064fb4f0f.tar.bz2 linux-stable-bc4f671161b6c3535b4b9e6fb6e408b064fb4f0f.zip |
powerpc/bpf: populate extable entries only during the last pass
commit 35a4b8ce4ac00e940b46b1034916ccb22ce9bdef upstream.
Since commit 85e031154c7c ("powerpc/bpf: Perform complete extra passes
to update addresses"), two additional passes are performed to avoid
space and CPU time wastage on powerpc. But these extra passes led to
WARN_ON_ONCE() hits in bpf_add_extable_entry() as extable entries are
populated again, during the extra pass, without resetting the index.
Fix it by resetting entry index before repopulating extable entries,
if and when there is an additional pass.
Fixes: 85e031154c7c ("powerpc/bpf: Perform complete extra passes to update addresses")
Cc: stable@vger.kernel.org # v6.3+
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230425065829.18189-1-hbathini@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/net/bpf_jit_comp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index e93aefcfb83f..37043dfc1add 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c @@ -101,6 +101,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) bpf_hdr = jit_data->header; proglen = jit_data->proglen; extra_pass = true; + /* During extra pass, ensure index is reset before repopulating extable entries */ + cgctx.exentry_idx = 0; goto skip_init_ctx; } |