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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c74b05030edb3b52f4208d8415b8c933bc509a29@git.kernel.org>
Date:   Sat, 13 Jul 2019 03:53:06 -0700
From:   tip-bot for Leo Yan <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     adrian.hunter@...el.com, alexander.shishkin@...ux.intel.com,
        namhyung@...nel.org, leo.yan@...aro.org, dave@...olabs.net,
        suzuki.poulose@....com, tmricht@...ux.ibm.com, jolsa@...nel.org,
        changbin.du@...el.com, tglx@...utronix.de, acme@...hat.com,
        mingo@...nel.org, yao.jin@...ux.intel.com, davem@...emloft.net,
        alexios.zavras@...el.com, peterz@...radead.org,
        songliubraving@...com, eric.saint.etienne@...cle.com,
        mathieu.poirier@...aro.org, alexey.budankov@...ux.intel.com,
        hpa@...or.com, khlebnikov@...dex-team.ru, ak@...ux.intel.com,
        linux@...musvillemoes.dk, linux-kernel@...r.kernel.org
Subject: [tip:perf/urgent] perf stat: Fix use-after-freed pointer detected
 by the smatch tool

Commit-ID:  c74b05030edb3b52f4208d8415b8c933bc509a29
Gitweb:     https://git.kernel.org/tip/c74b05030edb3b52f4208d8415b8c933bc509a29
Author:     Leo Yan <leo.yan@...aro.org>
AuthorDate: Tue, 2 Jul 2019 18:34:11 +0800
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 9 Jul 2019 09:33:54 -0300

perf stat: Fix use-after-freed pointer detected by the smatch tool

Based on the following report from Smatch, fix the use-after-freed
pointer.

  tools/perf/builtin-stat.c:1353
  add_default_attributes() warn: passing freed memory 'str'.

The pointer 'str' has been freed but later it is still passed into the
function parse_events_print_error().  This patch fixes this
use-after-freed issue.

Signed-off-by: Leo Yan <leo.yan@...aro.org>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Alexios Zavras <alexios.zavras@...el.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Changbin Du <changbin.du@...el.com>
Cc: Davidlohr Bueso <dave@...olabs.net>
Cc: David S. Miller <davem@...emloft.net>
Cc: Eric Saint-Etienne <eric.saint.etienne@...cle.com>
Cc: Jin Yao <yao.jin@...ux.intel.com>
Cc: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Song Liu <songliubraving@...com>
Cc: Suzuki Poulouse <suzuki.poulose@....com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Thomas Richter <tmricht@...ux.ibm.com>
Link: http://lkml.kernel.org/r/20190702103420.27540-3-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e5e19b461061..b81f7b197d24 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1349,8 +1349,8 @@ static int add_default_attributes(void)
 				fprintf(stderr,
 					"Cannot set up top down events %s: %d\n",
 					str, err);
-				free(str);
 				parse_events_print_error(&errinfo, str);
+				free(str);
 				return -1;
 			}
 		} else {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ