mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	bpf: fix register_btf_kfunc_id_set for !CONFIG_DEBUG_INFO_BTF
Commitdee872e124("bpf: Populate kfunc BTF ID sets in struct btf") breaks loading of some modules when CONFIG_DEBUG_INFO_BTF is not set. register_btf_kfunc_id_set returns -ENOENT to the callers when there is no module btf. Let's return 0 (success) instead to let those modules work in !CONFIG_DEBUG_INFO_BTF cases. Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Fixes:dee872e124("bpf: Populate kfunc BTF ID sets in struct btf") Signed-off-by: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/r/20220126001340.1573649-1-sdf@google.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
		
							parent
							
								
									fc1ca95585
								
							
						
					
					
						commit
						c446fdacb1
					
				
					 1 changed files with 13 additions and 2 deletions
				
			
		| 
						 | 
					@ -6740,8 +6740,19 @@ int register_btf_kfunc_id_set(enum bpf_prog_type prog_type,
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	btf = btf_get_module_btf(kset->owner);
 | 
						btf = btf_get_module_btf(kset->owner);
 | 
				
			||||||
	if (IS_ERR_OR_NULL(btf))
 | 
						if (!btf) {
 | 
				
			||||||
		return btf ? PTR_ERR(btf) : -ENOENT;
 | 
							if (!kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) {
 | 
				
			||||||
 | 
								pr_err("missing vmlinux BTF, cannot register kfuncs\n");
 | 
				
			||||||
 | 
								return -ENOENT;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) {
 | 
				
			||||||
 | 
								pr_err("missing module BTF, cannot register kfuncs\n");
 | 
				
			||||||
 | 
								return -ENOENT;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (IS_ERR(btf))
 | 
				
			||||||
 | 
							return PTR_ERR(btf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	hook = bpf_prog_type_to_kfunc_hook(prog_type);
 | 
						hook = bpf_prog_type_to_kfunc_hook(prog_type);
 | 
				
			||||||
	ret = btf_populate_kfunc_set(btf, hook, kset);
 | 
						ret = btf_populate_kfunc_set(btf, hook, kset);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue