diff options
author | Martin KaFai Lau <[email protected]> | 2017-06-05 12:15:49 -0700 |
---|---|---|
committer | David S. Miller <[email protected]> | 2017-06-06 15:41:23 -0400 |
commit | b16d9aa4c2b90af8d2c3201e245150f8c430c3bc (patch) | |
tree | 2fc2f74214723830c29d5f7370870507a97b7387 /lib/mpi/mpi-internal.h | |
parent | 34ad5580f8f9c86cb273ebea25c149613cd1667e (diff) |
bpf: Add BPF_PROG_GET_FD_BY_ID
Add BPF_PROG_GET_FD_BY_ID command to allow user to get a fd
from a bpf_prog's ID.
bpf_prog_inc_not_zero() is added and is called with prog_idr_lock
held.
__bpf_prog_put() is also added which has the 'bool do_idr_lock'
param to decide if the prog_idr_lock should be acquired when
freeing the prog->id.
In the error path of bpf_prog_inc_not_zero(), it may have to
call __bpf_prog_put(map, false) which does not need
to take the prog_idr_lock when freeing the prog->id.
It is currently limited to CAP_SYS_ADMIN which we can
consider to lift it in followup patches.
Signed-off-by: Martin KaFai Lau <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Acked-by: Daniel Borkmann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-internal.h')
0 files changed, 0 insertions, 0 deletions