From: Keisuke Nishimura Date: Fri, 20 Mar 2026 13:02:20 +0000 (+0100) Subject: bpf: Fix refcount check in check_struct_ops_btf_id() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25e3e1f1096089a64901ae1faa7b7b13446653db;p=thirdparty%2Flinux.git bpf: Fix refcount check in check_struct_ops_btf_id() The current implementation only checks whether the first argument is refcounted. Fix this by iterating over all arguments. Signed-off-by: Keisuke Nishimura Fixes: 38f1e66abd184 ("bpf: Do not allow tail call in strcut_ops program with __ref argument") Reviewed-by: Emil Tsalapatis Acked-by: Amery Hung Link: https://lore.kernel.org/r/20260320130219.63711-1-keisuke.nishimura@inria.fr Signed-off-by: Alexei Starovoitov --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index cd008b146ee52..88f622125376e 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -24959,7 +24959,7 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env) } for (i = 0; i < st_ops_desc->arg_info[member_idx].cnt; i++) { - if (st_ops_desc->arg_info[member_idx].info->refcounted) { + if (st_ops_desc->arg_info[member_idx].info[i].refcounted) { has_refcounted_arg = true; break; }