From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbcLGNnc (ORCPT ); Wed, 7 Dec 2016 08:43:32 -0500 Received: from terminus.zytor.com ([198.137.202.10]:42708 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752013AbcLGNna (ORCPT ); Wed, 7 Dec 2016 08:43:30 -0500 Date: Wed, 7 Dec 2016 05:43:04 -0800 From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: mingo@kernel.org, penguin-kernel@I-love.SAKURA.ne.jp, linux-kernel@vger.kernel.org, tglx@linutronix.de, bigeasy@linutronix.de, hpa@zytor.com Reply-To: hpa@zytor.com, bigeasy@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, penguin-kernel@I-love.SAKURA.ne.jp In-Reply-To: <20161207133133.hzkcqfllxcdi3joz@linutronix.de> References: <20161207133133.hzkcqfllxcdi3joz@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] tracing/rb: Init the CPU mask on allocation Git-Commit-ID: b18cc3de00ec3442cf40ac60787dbe0703b99e24 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: b18cc3de00ec3442cf40ac60787dbe0703b99e24 Gitweb: http://git.kernel.org/tip/b18cc3de00ec3442cf40ac60787dbe0703b99e24 Author: Sebastian Andrzej Siewior AuthorDate: Wed, 7 Dec 2016 14:31:33 +0100 Committer: Thomas Gleixner CommitDate: Wed, 7 Dec 2016 14:36:21 +0100 tracing/rb: Init the CPU mask on allocation Before commit b32614c03413 ("tracing/rb: Convert to hotplug state machine") the allocated cpumask was initialized to the mask of online or possible CPUs. After the CPU hotplug changes the buffer initialization moved to trace_rb_cpu_prepare() but the cpumask is allocated with alloc_cpumask() and therefor has random content. As a consequence the cpu buffers are not initialized and a later access dereferences a NULL pointer. Use zalloc_cpumask() instead so trace_rb_cpu_prepare() initializes the buffers properly. Fixes: b32614c03413 ("tracing/rb: Convert to hotplug state machine") Reported-by: Tetsuo Handa Signed-off-by: Sebastian Andrzej Siewior Cc: rostedt@goodmis.org Link: http://lkml.kernel.org/r/20161207133133.hzkcqfllxcdi3joz@linutronix.de Signed-off-by: Thomas Gleixner --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index a7a055f..89a2611a16 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1297,7 +1297,7 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, if (!buffer) return NULL; - if (!alloc_cpumask_var(&buffer->cpumask, GFP_KERNEL)) + if (!zalloc_cpumask_var(&buffer->cpumask, GFP_KERNEL)) goto fail_free_buffer; nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);