mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	bpf: Fix memleak in aux->func_info and aux->btf
The aux->func_info and aux->btf are leaked in the error out cases
during bpf_prog_load().  This patch fixes it.
Fixes: ba64e7d852 ("bpf: btf: support proper non-jit func info")
Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
			
			
This commit is contained in:
		
							parent
							
								
									71fc156ff5
								
							
						
					
					
						commit
						5482e9a93c
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -1560,6 +1560,8 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr)
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
free_used_maps:
 | 
					free_used_maps:
 | 
				
			||||||
 | 
						kvfree(prog->aux->func_info);
 | 
				
			||||||
 | 
						btf_put(prog->aux->btf);
 | 
				
			||||||
	bpf_prog_kallsyms_del_subprogs(prog);
 | 
						bpf_prog_kallsyms_del_subprogs(prog);
 | 
				
			||||||
	free_used_maps(prog->aux);
 | 
						free_used_maps(prog->aux);
 | 
				
			||||||
free_prog:
 | 
					free_prog:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue