Message ID | 1442249679-12899-1-git-send-email-will.deacon@arm.com |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBDAZZCVNSYPBBR7Y3OXQKGQEO3XQDZA@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id C974122B17 for <linaro@patches.linaro.org>; Mon, 14 Sep 2015 16:56:40 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf47878447lbc.1 for <linaro@patches.linaro.org>; Mon, 14 Sep 2015 09:56:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=Ln+4pKnWsmk1Jx7PDJ2p5kNIqza19i3v8vaAeXpq5Ho=; b=cLj0zZoENtTUvp85pRzkorl7hMezxaRA/qDOZxmtYcPvzAa4IbPTyhcUxLIZDcuOdL H1E2wPgsZYR2caGjCCWx53WX/dU5EyFJA8+qOlUYj5yDGNB+o0RUXIx8+dWTRh6jdVBU xhegOnTsHvZuwhvT4kSkBjgMDiBRA8/Q6XR8OZKXQzSNJTfFWz+kDukuPXwvIRAeCCFk VZ+k4sZ1XketTkfWQItWmDe2K5Ff0gjRMeo11HNHpUp63ZWQsTFTg7a9LOPDgWd1H5LF Z3dM3OPfc2Gan2aDFseoHwA4Ekd8eTOkUB1NlUTqONIvLFT2ewFL1/1XE+EbaMy+zXmj ej2A== X-Gm-Message-State: ALoCoQlZ3qqCHnNGKzrRU2ewAZBbjO8LqsrxyAb7UYYS2mPzRoXNucJeKtwP1iSugti5LWvU+gZ5 X-Received: by 10.112.63.165 with SMTP id h5mr3330313lbs.18.1442249799757; Mon, 14 Sep 2015 09:56:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.7 with SMTP id e7ls565199lab.70.gmail; Mon, 14 Sep 2015 09:56:39 -0700 (PDT) X-Received: by 10.112.198.97 with SMTP id jb1mr15572743lbc.8.1442249799544; Mon, 14 Sep 2015 09:56:39 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id wq1si10376465lac.103.2015.09.14.09.56.39 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 09:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbcjc2 with SMTP id jc2so70780851lbc.0 for <patchwork-forward@linaro.org>; Mon, 14 Sep 2015 09:56:39 -0700 (PDT) X-Received: by 10.112.130.70 with SMTP id oc6mr3178888lbb.32.1442249799385; Mon, 14 Sep 2015 09:56:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1304972lbq; Mon, 14 Sep 2015 09:56:38 -0700 (PDT) X-Received: by 10.66.243.225 with SMTP id xb1mr36737794pac.78.1442249798421; Mon, 14 Sep 2015 09:56:38 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ml8si24628857pab.240.2015.09.14.09.56.37 for <patch@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 09:56:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZbX1z-0006rY-2Q; Mon, 14 Sep 2015 16:55:03 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZbX1w-0006cn-1t for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2015 16:55:00 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.139]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id t8EGsawo019994; Mon, 14 Sep 2015 17:54:36 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 2C0991AE331C; Mon, 14 Sep 2015 17:54:42 +0100 (BST) From: Will Deacon <will.deacon@arm.com> To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] drivers/perf: arm_pmu: avoid CPU device_node reference leak Date: Mon, 14 Sep 2015 17:54:39 +0100 Message-Id: <1442249679-12899-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150914_095500_439666_7D191054 X-CRM114-Status: GOOD ( 11.95 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: <patchwork-forward.linaro.org> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Mark Rutland <mark.rutland@arm.com>, Will Deacon <will.deacon@arm.com>, Sudeep Holla <sudeep.holla@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 |
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 2365a32a595e..be3755c973e9 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -823,9 +823,15 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu) } /* Now look up the logical CPU number */ - for_each_possible_cpu(cpu) - if (dn == of_cpu_device_node_get(cpu)) + for_each_possible_cpu(cpu) { + struct device_node *cpu_dn; + + cpu_dn = of_cpu_device_node_get(cpu); + of_node_put(cpu_dn); + + if (dn == cpu_dn) break; + } if (cpu >= nr_cpu_ids) { pr_warn("Failed to find logical CPU for %s\n",
of_cpu_device_node_get increments the reference count on the CPU device_node, so we must take care to of_node_put once we've finished with it. This patch fixes the perf IRQ probing code to avoid the leak. Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> --- drivers/perf/arm_pmu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)