lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-e5plzjhx6595a5yjaf22jss3@git.kernel.org>
Date:   Thu, 6 Sep 2018 06:04:38 -0700
From:   tip-bot for Hisao Tanabe <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     xtanabe@...il.com, linux-kernel@...r.kernel.org,
        wangnan0@...wei.com, namhyung@...nel.org, jolsa@...hat.com,
        tglx@...utronix.de, mingo@...nel.org, hpa@...or.com,
        acme@...hat.com
Subject: [tip:perf/core] perf evsel: Fix potential null pointer dereference
 in perf_evsel__new_idx()

Commit-ID:  fd8d2702791a970c751f8b526a17d8e725a05b46
Gitweb:     https://git.kernel.org/tip/fd8d2702791a970c751f8b526a17d8e725a05b46
Author:     Hisao Tanabe <xtanabe@...il.com>
AuthorDate: Sat, 25 Aug 2018 00:45:56 +0900
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 30 Aug 2018 14:49:25 -0300

perf evsel: Fix potential null pointer dereference in perf_evsel__new_idx()

If evsel is NULL, we should return NULL to avoid a NULL pointer
dereference a bit later in the code.

Signed-off-by: Hisao Tanabe <xtanabe@...il.com>
Acked-by: Namhyung Kim <namhyung@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Wang Nan <wangnan0@...wei.com>
Fixes: 03e0a7df3efd ("perf tools: Introduce bpf-output event")
LPU-Reference: 20180824154556.23428-1-xtanabe@...il.com
Link: https://lkml.kernel.org/n/tip-e5plzjhx6595a5yjaf22jss3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/evsel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c980bbff6353..1a61628a1c12 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -251,8 +251,9 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
 {
 	struct perf_evsel *evsel = zalloc(perf_evsel__object.size);
 
-	if (evsel != NULL)
-		perf_evsel__init(evsel, attr, idx);
+	if (!evsel)
+		return NULL;
+	perf_evsel__init(evsel, attr, idx);
 
 	if (perf_evsel__is_bpf_output(evsel)) {
 		evsel->attr.sample_type |= (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ