bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put
authorTom Herbert <tom@herbertland.com>
Wed, 14 Oct 2015 21:40:44 +0000 (14:40 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Oct 2015 07:55:02 +0000 (00:55 -0700)
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: aaac3ba95e4c8b49 ("bpf: charge user for creation of BPF maps and programs")
Signed-off-by: Tom Herbert <tom@herbertland.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/syscall.c

index f640e5f7afbd7cece735fcbc1fe34a6d0355337a..687dd6ca574d4c3267b1290cc9f12702ad9346c1 100644 (file)
@@ -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);
        }
 }