]> Git Repo - linux.git/commitdiff
perf maps: Add missing unlock to maps__insert() error case
authorCengiz Can <[email protected]>
Mon, 20 Jan 2020 14:15:54 +0000 (17:15 +0300)
committerArnaldo Carvalho de Melo <[email protected]>
Fri, 31 Jan 2020 08:40:50 +0000 (09:40 +0100)
`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: a7c2b572e217 ("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]>
tools/perf/util/map.c

index fdd5bddb30756be1dce1d96cbf74fcc44e718644..f67960bedebba63663f573f28df9f746aa106910 100644 (file)
@@ -549,6 +549,7 @@ void maps__insert(struct maps *maps, struct map *map)
 
                        if (maps_by_name == NULL) {
                                __maps__free_maps_by_name(maps);
+                               up_write(&maps->lock);
                                return;
                        }
 
This page took 0.05246 seconds and 4 git commands to generate.