bpf: consolidate bpf_prog_put{, _rcu} dismantle paths
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 29 Oct 2015 13:58:08 +0000 (14:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Nov 2015 03:48:39 +0000 (22:48 -0500)
commite9d8afa90b789b07d414637ab557d169d6b2b84e
tree534e0a4721d7d9af501b4bdf10757a517109c3af
parentc210129760a010b555372ef74f4e1a46d4eb8a22
bpf: consolidate bpf_prog_put{, _rcu} dismantle paths

We currently have duplicated cleanup code in bpf_prog_put() and
bpf_prog_put_rcu() cleanup paths. Back then we decided that it was
not worth it to make it a common helper called by both, but with
the recent addition of resource charging, we could have avoided
the fix in commit ac00737f4e81 ("bpf: Need to call bpf_prog_uncharge_memlock
from bpf_prog_put") if we would have had only a single, common path.
We can simplify it further by assigning aux->prog only once during
allocation time.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/core.c
kernel/bpf/syscall.c