forked from mirrors/linux
		
	perf bpf: Return NULL when RB tree lookup fails in perf_env__find_btf()
We don't return NULL when we don't find the bpf_prog_info_node, fix
that.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Reported-by: Song Liu <songliubraving@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 3792cb2ff4 ("perf bpf: Save BTF in a rbtree in perf_env")
Link: http://lkml.kernel.org/r/20190417145539.11669-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									b9abbdfa88
								
							
						
					
					
						commit
						2db7b1e0bd
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -111,10 +111,12 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id)
 | 
				
			||||||
		else if (btf_id > node->id)
 | 
							else if (btf_id > node->id)
 | 
				
			||||||
			n = n->rb_right;
 | 
								n = n->rb_right;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			break;
 | 
								goto out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						node = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	up_read(&env->bpf_progs.lock);
 | 
						up_read(&env->bpf_progs.lock);
 | 
				
			||||||
 | 
					out:
 | 
				
			||||||
	return node;
 | 
						return node;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue