Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757552AbcLOLdJ (ORCPT ); Thu, 15 Dec 2016 06:33:09 -0500 Received: from terminus.zytor.com ([198.137.202.10]:41476 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757503AbcLOLdH (ORCPT ); Thu, 15 Dec 2016 06:33:07 -0500 Date: Thu, 15 Dec 2016 03:31:11 -0800 From: tip-bot for Thomas Gleixner Message-ID: Cc: sf84@laposte.net, anna-maria@linutronix.de, bigeasy@linutronix.de, slash.tmp@free.fr, thibaud_cornic@sigmadesigns.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, mingo@kernel.org, rcochran@linutronix.de, hpa@zytor.com, robin.murphy@arm.com, tglx@linutronix.de, daniel.lezcano@linaro.org Reply-To: linux-kernel@vger.kernel.org, mark.rutland@arm.com, bigeasy@linutronix.de, sf84@laposte.net, anna-maria@linutronix.de, thibaud_cornic@sigmadesigns.com, slash.tmp@free.fr, tglx@linutronix.de, daniel.lezcano@linaro.org, hpa@zytor.com, rcochran@linutronix.de, mingo@kernel.org, robin.murphy@arm.com In-Reply-To: <1147ef90-7877-e4d2-bb2b-5c4fa8d3144b@free.fr> References: <1147ef90-7877-e4d2-bb2b-5c4fa8d3144b@free.fr> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] tick/broadcast: Prevent NULL pointer dereference Git-Commit-ID: c1a9eeb938b5433947e5ea22f89baff3182e7075 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: 1762 Lines: 46 Commit-ID: c1a9eeb938b5433947e5ea22f89baff3182e7075 Gitweb: http://git.kernel.org/tip/c1a9eeb938b5433947e5ea22f89baff3182e7075 Author: Thomas Gleixner AuthorDate: Thu, 15 Dec 2016 12:10:37 +0100 Committer: Thomas Gleixner CommitDate: Thu, 15 Dec 2016 12:25:13 +0100 tick/broadcast: Prevent NULL pointer dereference When a disfunctional timer, e.g. dummy timer, is installed, the tick core tries to setup the broadcast timer. If no broadcast device is installed, the kernel crashes with a NULL pointer dereference in tick_broadcast_setup_oneshot() because the function has no sanity check. Reported-by: Mason Signed-off-by: Thomas Gleixner Cc: Mark Rutland Cc: Anna-Maria Gleixner Cc: Richard Cochran Cc: Sebastian Andrzej Siewior Cc: Daniel Lezcano Cc: Peter Zijlstra , Cc: Sebastian Frias Cc: Thibaud Cornic Cc: Robin Murphy Link: http://lkml.kernel.org/r/1147ef90-7877-e4d2-bb2b-5c4fa8d3144b@free.fr --- kernel/time/tick-broadcast.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index f6aae79..d2a20e8 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -871,6 +871,9 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { int cpu = smp_processor_id(); + if (!bc) + return; + /* Set it up only once ! */ if (bc->event_handler != tick_handle_oneshot_broadcast) { int was_periodic = clockevent_state_periodic(bc);