netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put
@ 2015-10-14 21:40 Tom Herbert
  2015-10-14 21:51 ` Alexei Starovoitov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Herbert @ 2015-10-14 21:40 UTC (permalink / raw)
  To: davem, netdev, ast; +Cc: kernel-team

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")
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 kernel/bpf/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index f640e5f..687dd6c 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -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);
 	}
 }
-- 
2.4.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put
  2015-10-14 21:40 [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put Tom Herbert
@ 2015-10-14 21:51 ` Alexei Starovoitov
  2015-10-15  8:42 ` Daniel Borkmann
  2015-10-16  8:02 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2015-10-14 21:51 UTC (permalink / raw)
  To: Tom Herbert, davem, netdev; +Cc: kernel-team

On 10/14/15 2:40 PM, Tom Herbert wrote:
> 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")
> Signed-off-by: Tom Herbert<tom@herbertland.com>

ohh. right. good catch. thanks!
Acked-by: Alexei Starovoitov <ast@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put
  2015-10-14 21:40 [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put Tom Herbert
  2015-10-14 21:51 ` Alexei Starovoitov
@ 2015-10-15  8:42 ` Daniel Borkmann
  2015-10-16  8:02 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2015-10-15  8:42 UTC (permalink / raw)
  To: Tom Herbert, davem, netdev, ast; +Cc: kernel-team

On 10/14/2015 11:40 PM, Tom Herbert wrote:
> 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).

> Signed-off-by: Tom Herbert <tom@herbertland.com>

Fix looks good to me, so:

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put
  2015-10-14 21:40 [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put Tom Herbert
  2015-10-14 21:51 ` Alexei Starovoitov
  2015-10-15  8:42 ` Daniel Borkmann
@ 2015-10-16  8:02 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-10-16  8:02 UTC (permalink / raw)
  To: tom; +Cc: netdev, ast, kernel-team

From: Tom Herbert <tom@herbertland.com>
Date: Wed, 14 Oct 2015 14:40:44 -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: commit aaac3ba95e4c8b49 ("bpf: charge user for creation of BPF maps and programs")
> Signed-off-by: Tom Herbert <tom@herbertland.com>

Applied, with Fixes: tag fixed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-16  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14 21:40 [PATCH net-next] bpf: Need to call bpf_prog_uncharge_memlock from bpf_prog_put Tom Herbert
2015-10-14 21:51 ` Alexei Starovoitov
2015-10-15  8:42 ` Daniel Borkmann
2015-10-16  8:02 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).