Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbdF2Tg3 (ORCPT ); Thu, 29 Jun 2017 15:36:29 -0400 Received: from terminus.zytor.com ([65.50.211.136]:39303 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbdF2TgV (ORCPT ); Thu, 29 Jun 2017 15:36:21 -0400 Date: Thu, 29 Jun 2017 12:35:04 -0700 From: tip-bot for Kan Liang Message-ID: Cc: kan.liang@intel.com, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, kan.liang@intel.com, hpa@zytor.com In-Reply-To: <20170629190926.2456-1-kan.liang@intel.com> References: <20170629190926.2456-1-kan.liang@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] perf/x86/intel/uncore: Fix wrong box pointer check Git-Commit-ID: 80c65fdb4c6920e332a9781a3de5877594b07522 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 Content-Length: 1465 Lines: 38 Commit-ID: 80c65fdb4c6920e332a9781a3de5877594b07522 Gitweb: http://git.kernel.org/tip/80c65fdb4c6920e332a9781a3de5877594b07522 Author: Kan Liang AuthorDate: Thu, 29 Jun 2017 12:09:26 -0700 Committer: Thomas Gleixner CommitDate: Thu, 29 Jun 2017 21:28:13 +0200 perf/x86/intel/uncore: Fix wrong box pointer check Should not init a NULL box. It will cause system crash. The issue looks like caused by a typo. This was not noticed because there is no NULL box. Also, for most boxes, they are enabled by default. The init code is not critical. Fixes: fff4b87e594a ("perf/x86/intel/uncore: Make package handling more robust") Signed-off-by: Kan Liang Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20170629190926.2456-1-kan.liang@intel.com --- arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 758c1aa..44ec523 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -1170,7 +1170,7 @@ static int uncore_event_cpu_online(unsigned int cpu) pmu = type->pmus; for (i = 0; i < type->num_boxes; i++, pmu++) { box = pmu->boxes[pkg]; - if (!box && atomic_inc_return(&box->refcnt) == 1) + if (box && atomic_inc_return(&box->refcnt) == 1) uncore_box_init(box); } }