[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1466578626-92406-6-git-send-email-hekuang@huawei.com>
Date: Wed, 22 Jun 2016 06:57:06 +0000
From: He Kuang <hekuang@...wei.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...hat.com>,
<wangnan0@...wei.com>, <hekuang@...wei.com>, <jpoimboe@...hat.com>,
<ak@...ux.intel.com>, <eranian@...gle.com>, <namhyung@...nel.org>,
<adrian.hunter@...el.com>, <sukadev@...ux.vnet.ibm.com>,
<masami.hiramatsu.pt@...achi.com>, <tumanova@...ux.vnet.ibm.com>,
<kan.liang@...el.com>, <penberg@...nel.org>, <dsahern@...il.com>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found
We should check if 'dso' is a null pointer before passing it to the
function dso__type(), otherwise a segfault will be raised in
dso__data_get_fd(). In function machine__find_vdso(), the return value
checking of 'dso' is missed and this patch fixes this issue.
Signed-off-by: He Kuang <hekuang@...wei.com>
---
tools/perf/util/vdso.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 8f81c41..7bdcad4 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct machine *machine,
if (!dso) {
dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO,
true);
- if (dso_type != dso__type(dso, machine))
+ if (dso && dso_type != dso__type(dso, machine))
dso = NULL;
}
break;
--
1.8.5.2
Powered by blists - more mailing lists