diff options
| author | Kui-Feng Lee <thinker.li@gmail.com> | 2024-05-29 23:59:42 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-25 11:03:01 +0100 |
| commit | 30752d8bbd149abce36f37e83b89bd2934bfa33c (patch) | |
| tree | db02dbda997f5c4a92a5ca7051481c39b5ef26a4 /kernel/bpf/syscall.c | |
| parent | c362b43580cf2179e2a618a4f0da72f03d609668 (diff) | |
| download | linux-30752d8bbd149abce36f37e83b89bd2934bfa33c.tar.gz linux-30752d8bbd149abce36f37e83b89bd2934bfa33c.tar.bz2 linux-30752d8bbd149abce36f37e83b89bd2934bfa33c.zip | |
bpf: export bpf_link_inc_not_zero.
[ Upstream commit 67c3e8353f45c27800eecc46e00e8272f063f7d1 ]
bpf_link_inc_not_zero() will be used by kernel modules. We will use it in
bpf_testmod.c later.
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Link: https://lore.kernel.org/r/20240530065946.979330-5-thinker.li@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Stable-dep-of: 56145d237385 ("bpf: Fix a UAF issue in bpf_trampoline_link_cgroup_shim")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel/bpf/syscall.c')
| -rw-r--r-- | kernel/bpf/syscall.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index b559d99e5959..ed8f55bdc137 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4763,10 +4763,11 @@ static int link_detach(union bpf_attr *attr) return ret; } -static struct bpf_link *bpf_link_inc_not_zero(struct bpf_link *link) +struct bpf_link *bpf_link_inc_not_zero(struct bpf_link *link) { return atomic64_fetch_add_unless(&link->refcnt, 1, 0) ? link : ERR_PTR(-ENOENT); } +EXPORT_SYMBOL(bpf_link_inc_not_zero); struct bpf_link *bpf_link_by_id(u32 id) { |
