Skip to contentSkip to conversation

bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put

PATCH Applied Tom Herbert 4 participants 4 messages Oct 14, 2015 – Oct 16, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put

Currently, is only called from __prog_put_rcu in the bpf_prog_release path. Need this to call this from bpf_prog_put also to get correct accounting.

Fixes commit aaac3ba95e4c8b49 ("bpf: charge user for creation of BPF maps and programs")
---
 kernel/bpf/syscall.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/syscall.c +1 -0
index f640e5f..687dd6c 100644
@@ -520,6 +520,7 @@ void bpf_prog_put(struct bpf_prog *prog)
 {
 	if (atomic_dec_and_test(&prog->aux->refcnt)) {
 		free_used_maps(prog->aux);
+		bpf_prog_uncharge_memlock(prog);
 		bpf_prog_free(prog);
 	}
 }
Signature · 1 line
2.4.6
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Tom Herbert
Quoted 5 lines · Tom Herbert

Currently, is only called from __prog_put_rcu in the bpf_prog_release path. Need this to call this from bpf_prog_put also to get correct accounting.

Fixes commit aaac3ba95e4c8b49 ("bpf: charge user for creation of BPF maps and programs")

Btw, "commit" should not be part of the Fixes tag (see SubmittingPatches +187).

Quoted 1 line

Fix looks good to me, so:

maintainer Applied
#3 lore raw
In reply to Tom Herbert

From: Tom Herbert <[email protected]>
Date: Wed, 14 Oct 2015 14:40:44 -0700

Quoted 6 lines

Currently, is only called from __prog_put_rcu in the bpf_prog_release path. Need this to call this from bpf_prog_put also to get correct accounting.

Fixes commit aaac3ba95e4c8b49 ("bpf: charge user for creation of BPF maps and programs")

Applied, with Fixes: tag fixed.