Skip to content
Closed
3 changes: 3 additions & 0 deletions arch/arm64/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,9 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,
void *image, *tmp;
int ret;

if (tlinks[BPF_TRAMP_SESSION].nr_links)
return -EOPNOTSUPP;

/* image doesn't need to be in module memory range, so we can
* use kvmalloc.
*/
Expand Down
3 changes: 3 additions & 0 deletions arch/loongarch/net/bpf_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,9 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,
void *image, *tmp;
struct jit_ctx ctx;

if (tlinks[BPF_TRAMP_SESSION].nr_links)
return -EOPNOTSUPP;

size = ro_image_end - ro_image;
image = kvmalloc(size, GFP_KERNEL);
if (!image)
Expand Down
3 changes: 3 additions & 0 deletions arch/powerpc/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,9 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i
void *rw_image, *tmp;
int ret;

if (tlinks[BPF_TRAMP_SESSION].nr_links)
return -EOPNOTSUPP;

/*
* rw_image doesn't need to be in module memory range, so we can
* use kvmalloc.
Expand Down
3 changes: 3 additions & 0 deletions arch/riscv/net/bpf_jit_comp64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,9 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,
struct rv_jit_context ctx;
u32 size = ro_image_end - ro_image;

if (tlinks[BPF_TRAMP_SESSION].nr_links)
return -EOPNOTSUPP;

image = kvmalloc(size, GFP_KERNEL);
if (!image)
return -ENOMEM;
Expand Down
3 changes: 3 additions & 0 deletions arch/s390/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2924,6 +2924,9 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
struct bpf_tramp_jit tjit;
int ret;

if (tlinks[BPF_TRAMP_SESSION].nr_links)
return -EOPNOTSUPP;

/* Compute offsets, check whether the code fits. */
memset(&tjit, 0, sizeof(tjit));
ret = __arch_prepare_bpf_trampoline(im, &tjit, m, flags,
Expand Down
Loading
Loading