diff options
| author | Kaitao Cheng <chengkaitao@kylinos.cn> | 2026-05-21 06:23:04 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-05-21 12:47:46 +0300 |
| commit | a3493ca504f16877bf29a123f27835c3f841a05f (patch) | |
| tree | e8296685ec1a00f2a84bc95a44d0c6acb07c8240 /include/linux | |
| parent | e6919ff67c1e612ec1ce3be51dba6e7ffc47997a (diff) | |
| download | linux-a3493ca504f16877bf29a123f27835c3f841a05f.tar.xz | |
bpf: Add bpf_list_add to insert node after a given list node
Add a new kfunc bpf_list_add(head, new, prev, meta, off) that
inserts 'new' after 'prev' in the BPF linked list. Both must be in
the same list; 'prev' must already be in the list. The new node must
be an owning reference (e.g. from bpf_obj_new); the kfunc consumes
that reference and the node becomes non-owning once inserted.
We have added an additional parameter bpf_list_head *head to
bpf_list_add, as the verifier requires the head parameter to
check whether the lock is being held.
Returns 0 on success, -EINVAL if 'prev' is not in a list or 'new'
is already in a list (or duplicate insertion). On failure, the
kernel drops the passed-in node.
Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
Reviewed-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20260521032306.97118-7-kaitao.cheng@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
