mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
LoongArch: BPF: Make error handling robust in arch_prepare_bpf_trampoline()
Bail out instead of trying to perform a bpf_arch_text_copy() if __arch_prepare_bpf_trampoline() failed. Cc: stable@vger.kernel.org Tested-by: Vincent Li <vincent.mc.li@gmail.com> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
ea645cfd3d
commit
de2c0b7788
1 changed files with 4 additions and 1 deletions
|
|
@ -1715,7 +1715,10 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,
|
|||
|
||||
jit_fill_hole(image, (unsigned int)(ro_image_end - ro_image));
|
||||
ret = __arch_prepare_bpf_trampoline(&ctx, im, m, tlinks, func_addr, flags);
|
||||
if (ret > 0 && validate_code(&ctx) < 0) {
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
if (validate_code(&ctx) < 0) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue