From patchwork Thu Mar 5 14:14:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 45460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D4203204BC for ; Thu, 5 Mar 2015 14:14:38 +0000 (UTC) Received: by wggy19 with SMTP id y19sf39195028wgg.1 for ; Thu, 05 Mar 2015 06:14:38 -0800 (PST) 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:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=nuE6xaDWmQ5kx/tdlJUeXxxNsfHsx4epPcYZ00YVtdI=; b=aAIhVsPq71xAQ1fksqTLbQK5FOtPcaFHprPN4D00ZmX5KuYGGgra5ehYnZ0mu7Tlg/ Jboe8mINC7LKgNoVzCI9M1w4CVkyUF2+NK11H1ZC6FgPu4hLDkA/2dyGdhoOknMKUGTi X3MRk+nKvrpkVdWHCQuJp5/jQtMRFD0r/XwSmtEwMSmhnEsLoeak9YaDcfV26fnhGDC9 DjgI3YNxSg3BPJjXfx66IaQGBJtxT7lPvIGNlJs9GZetaQRVlnHdZEgLh96UeEClgH6B shA45/8K8xCQ4NbkvjH+aNS/VSPaenw/3V+/vq6v6iazg/pty2F35ujOeU431Q8AowLN 11iQ== X-Gm-Message-State: ALoCoQluI6lutyChXtZeKcw9FH6My/J6D8CERXutB4pX2dvxSYYvwMZ6DiqFRD+8qI2hbpRstcdB X-Received: by 10.112.35.135 with SMTP id h7mr1517315lbj.23.1425564877909; Thu, 05 Mar 2015 06:14:37 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.100 with SMTP id a4ls8082lah.23.gmail; Thu, 05 Mar 2015 06:14:37 -0800 (PST) X-Received: by 10.112.123.133 with SMTP id ma5mr8225133lbb.122.1425564877588; Thu, 05 Mar 2015 06:14:37 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id q1si4588123laj.84.2015.03.05.06.14.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 06:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbiz12 with SMTP id z12so28688658lbi.5 for ; Thu, 05 Mar 2015 06:14:37 -0800 (PST) X-Received: by 10.152.22.67 with SMTP id b3mr7815503laf.117.1425564877446; Thu, 05 Mar 2015 06:14:37 -0800 (PST) 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.35.133 with SMTP id h5csp510243lbj; Thu, 5 Mar 2015 06:14:36 -0800 (PST) X-Received: by 10.66.147.169 with SMTP id tl9mr15955294pab.63.1425564875471; Thu, 05 Mar 2015 06:14:35 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb7si9462876pdb.213.2015.03.05.06.14.34; Thu, 05 Mar 2015 06:14:35 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756006AbbCEOO3 (ORCPT + 28 others); Thu, 5 Mar 2015 09:14:29 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:36601 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755658AbbCEOO2 (ORCPT ); Thu, 5 Mar 2015 09:14:28 -0500 Received: by wesq59 with SMTP id q59so16228011wes.3 for ; Thu, 05 Mar 2015 06:14:27 -0800 (PST) X-Received: by 10.194.193.9 with SMTP id hk9mr19626660wjc.42.1425564867088; Thu, 05 Mar 2015 06:14:27 -0800 (PST) Received: from mai.lan (135-224-190-109.dsl.ovh.fr. [109.190.224.135]) by mx.google.com with ESMTPSA id q20sm8112064wiw.7.2015.03.05.06.14.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Mar 2015 06:14:26 -0800 (PST) From: Daniel Lezcano To: mingo@kernel.org, tglx@linutronix.de Cc: yongbae2@gmail.com, u.kleine-koenig@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] clocksource: efm32: Fix a NULL pointer dereference Date: Thu, 5 Mar 2015 15:14:22 +0100 Message-Id: <1425564863-26399-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <54F8641E.9010407@linaro.org> References: <54F8641E.9010407@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org 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.176 as permitted sender) smtp.mail=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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Yongbae Park The initialisation of the efm32 clocksource first sets up the irq and only after that initialises the data needed for irq handling. In case this initialisation is delayed the irq handler would dereference a NULL pointer. I'm not aware of anything that could delay the process in such a way, but it's better to be safe than sorry, so setup the irq only when the clock event device is ready. Cc: stable@vger.kernel.org Acked-by: Uwe Kleine-König Signed-off-by: Yongbae Park Signed-off-by: Daniel Lezcano --- drivers/clocksource/time-efm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/time-efm32.c b/drivers/clocksource/time-efm32.c index bba62f9..ec57ba2 100644 --- a/drivers/clocksource/time-efm32.c +++ b/drivers/clocksource/time-efm32.c @@ -225,12 +225,12 @@ static int __init efm32_clockevent_init(struct device_node *np) clock_event_ddata.base = base; clock_event_ddata.periodic_top = DIV_ROUND_CLOSEST(rate, 1024 * HZ); - setup_irq(irq, &efm32_clock_event_irq); - clockevents_config_and_register(&clock_event_ddata.evtdev, DIV_ROUND_CLOSEST(rate, 1024), 0xf, 0xffff); + setup_irq(irq, &efm32_clock_event_irq); + return 0; err_get_irq: