[tip:perf/core] perf: fix temporary file ownership check

From: tip-bot for Vasiliy Kulikov
Date: Sun Aug 14 2011 - 11:38:56 EST


Commit-ID: e9b52ef2228cd0bed7a4465c693a39489e2c338d
Gitweb: http://git.kernel.org/tip/e9b52ef2228cd0bed7a4465c693a39489e2c338d
Author: Vasiliy Kulikov <segoon@xxxxxxxxxxxx>
AuthorDate: Fri, 12 Aug 2011 00:55:37 +0400
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Fri, 12 Aug 2011 08:28:17 -0300

perf: fix temporary file ownership check

A file in /tmp/ might be a symlink, so lstat() should be used instead of
stat().

Acked-by: Pekka Enberg <penberg@xxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Pekka Enberg <penberg@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Link: 20110811205537.GA22864@albatros">http://lkml.kernel.org/r/20110811205537.GA22864@albatros
Signed-off-by: Vasiliy Kulikov <segoon@xxxxxxxxxxxx>
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/symbol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e142c21..469c026 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1506,7 +1506,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
struct stat st;

- if (stat(dso->name, &st) < 0)
+ if (lstat(dso->name, &st) < 0)
return -1;

if (st.st_uid && (st.st_uid != geteuid())) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/