From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755361AbcITVqN (ORCPT ); Tue, 20 Sep 2016 17:46:13 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39376 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755133AbcITVqH (ORCPT ); Tue, 20 Sep 2016 17:46:07 -0400 Date: Tue, 20 Sep 2016 14:45:54 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: acme@redhat.com, namhyung@kernel.org, jmario@redhat.com, hpa@zytor.com, a.p.zijlstra@chello.nl, mingo@kernel.org, jolsa@redhat.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, tglx@linutronix.de, dzickus@redhat.com, andi@firstfloor.org, dsahern@gmail.com Reply-To: jolsa@kernel.org, linux-kernel@vger.kernel.org, jolsa@redhat.com, mingo@kernel.org, hpa@zytor.com, a.p.zijlstra@chello.nl, jmario@redhat.com, namhyung@kernel.org, acme@redhat.com, dsahern@gmail.com, andi@firstfloor.org, dzickus@redhat.com, tglx@linutronix.de In-Reply-To: <20160920161245.GA8995@krava> References: <20160920161245.GA8995@krava> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf symbols: Do not open device files Git-Commit-ID: 3c028a0cb5b71f47d523bc8ad2c597cb257f41fb X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3c028a0cb5b71f47d523bc8ad2c597cb257f41fb Gitweb: http://git.kernel.org/tip/3c028a0cb5b71f47d523bc8ad2c597cb257f41fb Author: Jiri Olsa AuthorDate: Tue, 20 Sep 2016 18:12:45 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 20 Sep 2016 16:20:21 -0300 perf symbols: Do not open device files The dso__read_binary_type_filename gets the dso's file name to open. We need to check it for regular file before trying to open it, otherwise we might get stuck with device file. Signed-off-by: Jiri Olsa Cc: Andi Kleen Cc: David Ahern Cc: Don Zickus Cc: Joe Mario Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20160920161245.GA8995@krava Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/dso.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 774f6ec..d2c6cdd 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -363,6 +363,9 @@ static int __open_dso(struct dso *dso, struct machine *machine) return -EINVAL; } + if (!is_regular_file(name)) + return -EINVAL; + fd = do_open(name); free(name); return fd;