android_kernel_xiaomi_sdm845/kernel/bpf
Alexei Starovoitov abf2e7d6e2 bpf: add missing rcu protection when releasing programs from prog_array
Normally the program attachment place (like sockets, qdiscs) takes
care of rcu protection and calls bpf_prog_put() after a grace period.
The programs stored inside prog_array may not be attached anywhere,
so prog_array needs to take care of preserving rcu protection.
Otherwise bpf_tail_call() will race with bpf_prog_put().
To solve that introduce bpf_prog_put_rcu() helper function and use
it in 3 places where unattached program can decrement refcnt:
closing program fd, deleting/replacing program in prog_array.

Fixes: 04fd61ab36 ("bpf: allow bpf programs to tail-call other bpf programs")
Reported-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-31 00:27:51 -07:00
..
arraymap.c bpf: add missing rcu protection when releasing programs from prog_array 2015-05-31 00:27:51 -07:00
core.c bpf: allow bpf programs to tail-call other bpf programs 2015-05-21 17:07:59 -04:00
hashtab.c ebpf: constify various function pointer structs 2015-03-01 14:05:18 -05:00
helpers.c ebpf: add helper for obtaining current processor id 2015-03-15 21:57:25 -04:00
Makefile ebpf: remove kernel test stubs 2015-03-01 14:05:18 -05:00
syscall.c bpf: add missing rcu protection when releasing programs from prog_array 2015-05-31 00:27:51 -07:00
verifier.c bpf: allow bpf programs to tail-call other bpf programs 2015-05-21 17:07:59 -04:00