]> www.infradead.org Git - users/willy/linux.git/commitdiff
perf vdso: Missed put on 32-bit dsos
authorIan Rogers <irogers@google.com>
Thu, 12 Sep 2024 18:27:57 +0000 (11:27 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 27 Sep 2024 18:38:52 +0000 (15:38 -0300)
If the dso type doesn't match then NULL is returned but the dso should
be put first.

Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240912182757.762369-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/vdso.c

index 1b6f8f6db7aa47142b3b58ff2459cffa475f5ca0..c12f5d8c4bf696464a9971e2c9733e601532757e 100644 (file)
@@ -308,8 +308,10 @@ static struct dso *machine__find_vdso(struct machine *machine,
                if (!dso) {
                        dso = dsos__find(&machine->dsos, DSO__NAME_VDSO,
                                         true);
-                       if (dso && dso_type != dso__type(dso, machine))
+                       if (dso && dso_type != dso__type(dso, machine)) {
+                               dso__put(dso);
                                dso = NULL;
+                       }
                }
                break;
        case DSO__TYPE_X32BIT: