Skip to content

Commit 85fc95d

Browse files
cengiz-ioacmel
authored andcommitted
perf maps: Add missing unlock to maps__insert() error case
`tools/perf/util/map.c` has a function named `maps__insert` that acquires a write lock if its in multithread context. Even though this lock is released when function successfully completes, there's a branch that is executed when `maps_by_name == NULL` that returns from this function without releasing the write lock. Added an `up_write` to release the lock when this happens. Fixes: a7c2b57 ("perf map_groups: Auto sort maps by name, if needed") Signed-off-by: Cengiz Can <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 1873f15 commit 85fc95d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/util/map.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ void maps__insert(struct maps *maps, struct map *map)
549549

550550
if (maps_by_name == NULL) {
551551
__maps__free_maps_by_name(maps);
552+
up_write(&maps->lock);
552553
return;
553554
}
554555

0 commit comments

Comments
 (0)